@google/adk 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/agents/agent_engine_client.js +172 -0
- package/dist/cjs/agents/base_agent.js +20 -4
- package/dist/cjs/agents/functions.js +28 -0
- package/dist/cjs/agents/instructions.js +2 -1
- package/dist/cjs/agents/llm_agent.js +19 -6
- package/dist/cjs/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/code_execution_request_processor.js +8 -0
- package/dist/cjs/agents/processors/content_processor_utils.js +38 -10
- package/dist/cjs/agents/processors/content_request_processor.js +34 -2
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/nl_planning_processor.js +12 -3
- package/dist/cjs/cli/utils/logs.js +6 -6
- package/dist/cjs/code_executors/container_code_executor.js +27 -16
- package/dist/cjs/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/cjs/common.js +9 -20
- package/dist/cjs/errors/input_validation_error.js +3 -2
- package/dist/cjs/index.js +9 -2
- package/dist/cjs/plugins/base_plugin.js +13 -23
- package/dist/cjs/sessions/base_session_service.js +14 -8
- package/dist/cjs/sessions/database_session_service.js +50 -28
- package/dist/cjs/sessions/stale_session_error.js +59 -0
- package/dist/cjs/skills/loader.js +52 -18
- package/dist/cjs/telemetry/setup.js +0 -1
- package/dist/cjs/telemetry/tracing.js +53 -10
- package/dist/cjs/tools/apihub_tool/apihub_toolset.js +18 -23
- package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +120 -42
- package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +163 -95
- package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +13 -9
- package/dist/cjs/tools/application_integration_tool/integration_connector_tool.js +184 -0
- package/dist/cjs/tools/google_api_tool/google_api_tool.js +4 -1
- package/dist/cjs/tools/google_api_tool/google_api_toolset.js +173 -0
- package/dist/cjs/tools/google_api_tool/google_api_toolsets.js +124 -0
- package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +2 -2
- package/dist/cjs/tools/google_api_tool/index.js +20 -23
- package/dist/cjs/tools/load_artifacts_tool.js +12 -6
- package/dist/cjs/tools/load_memory_tool.js +12 -10
- package/dist/cjs/tools/mcp/mcp_toolset.js +1 -14
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/cjs/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/cjs/tools/openapi_tool/openapi_toolset.js +7 -13
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +17 -1
- package/dist/cjs/tools/toolbox_toolset.js +174 -0
- package/dist/cjs/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/cjs/utils/client_labels.js +19 -2
- package/dist/cjs/utils/failover_utils.js +1 -1
- package/dist/cjs/utils/gemini_schema_util.js +24 -6
- package/dist/cjs/utils/logger_node.js +4 -0
- package/dist/cjs/utils/output_schema_utils.js +5 -2
- package/dist/cjs/utils/task.js +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/agents/agent_engine_client.js +144 -0
- package/dist/esm/agents/base_agent.js +20 -4
- package/dist/esm/agents/functions.js +28 -0
- package/dist/esm/agents/instructions.js +2 -1
- package/dist/esm/agents/llm_agent.js +19 -6
- package/dist/esm/agents/processors/basic_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/code_execution_request_processor.js +8 -0
- package/dist/esm/agents/processors/content_processor_utils.js +38 -10
- package/dist/esm/agents/processors/content_request_processor.js +34 -2
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/nl_planning_processor.js +12 -3
- package/dist/esm/cli/utils/logs.js +4 -4
- package/dist/esm/code_executors/container_code_executor.js +27 -16
- package/dist/esm/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/esm/common.js +10 -13
- package/dist/esm/errors/input_validation_error.js +3 -2
- package/dist/esm/index.js +17 -3
- package/dist/esm/plugins/base_plugin.js +13 -23
- package/dist/esm/sessions/base_session_service.js +12 -7
- package/dist/esm/sessions/database_session_service.js +49 -28
- package/dist/esm/sessions/stale_session_error.js +31 -0
- package/dist/esm/skills/loader.js +51 -17
- package/dist/esm/telemetry/setup.js +1 -2
- package/dist/esm/telemetry/tracing.js +57 -11
- package/dist/esm/tools/apihub_tool/apihub_toolset.js +17 -22
- package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +124 -42
- package/dist/esm/tools/application_integration_tool/clients/connections_client.js +163 -95
- package/dist/esm/tools/application_integration_tool/clients/integration_client.js +13 -9
- package/dist/esm/tools/application_integration_tool/integration_connector_tool.js +158 -0
- package/dist/esm/tools/google_api_tool/google_api_tool.js +4 -1
- package/dist/esm/tools/google_api_tool/google_api_toolset.js +146 -0
- package/dist/esm/tools/google_api_tool/google_api_toolsets.js +94 -0
- package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +2 -2
- package/dist/esm/tools/google_api_tool/index.js +18 -20
- package/dist/esm/tools/load_artifacts_tool.js +10 -5
- package/dist/esm/tools/load_memory_tool.js +12 -10
- package/dist/esm/tools/mcp/mcp_toolset.js +1 -14
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.js +20 -6
- package/dist/esm/tools/openapi_tool/openapi_spec_parser/operation_parser.js +17 -6
- package/dist/esm/tools/openapi_tool/openapi_toolset.js +6 -12
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +17 -1
- package/dist/esm/tools/toolbox_toolset.js +148 -0
- package/dist/esm/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/esm/utils/client_labels.js +19 -2
- package/dist/esm/utils/failover_utils.js +1 -1
- package/dist/esm/utils/gemini_schema_util.js +23 -6
- package/dist/esm/utils/logger_node.js +4 -0
- package/dist/esm/utils/output_schema_utils.js +5 -2
- package/dist/esm/utils/task.js +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/agents/agent_engine_client.d.ts +37 -0
- package/dist/types/agents/base_agent.d.ts +12 -0
- package/dist/types/agents/llm_agent.d.ts +5 -1
- package/dist/types/agents/processors/content_processor_utils.d.ts +4 -2
- package/dist/types/agents/processors/nl_planning_processor.d.ts +2 -1
- package/dist/types/cli/utils/logs.d.ts +1 -1
- package/dist/types/code_executors/container_code_executor.d.ts +17 -5
- package/dist/types/common.d.ts +5 -9
- package/dist/types/errors/input_validation_error.d.ts +2 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/plugins/base_plugin.d.ts +0 -10
- package/dist/types/sessions/base_session_service.d.ts +5 -0
- package/dist/types/sessions/database_session_service.d.ts +17 -1
- package/dist/types/sessions/stale_session_error.d.ts +21 -0
- package/dist/types/skills/loader.d.ts +3 -2
- package/dist/types/telemetry/tracing.d.ts +17 -3
- package/dist/types/tools/apihub_tool/apihub_toolset.d.ts +14 -21
- package/dist/types/tools/application_integration_tool/application_integration_toolset.d.ts +32 -9
- package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +22 -8
- package/dist/types/tools/application_integration_tool/clients/integration_client.d.ts +3 -3
- package/dist/types/tools/application_integration_tool/integration_connector_tool.d.ts +70 -0
- package/dist/types/tools/base_toolset.d.ts +6 -5
- package/dist/types/tools/google_api_tool/google_api_tool.d.ts +10 -3
- package/dist/types/tools/google_api_tool/google_api_toolset.d.ts +55 -0
- package/dist/types/tools/google_api_tool/google_api_toolsets.d.ts +48 -0
- package/dist/types/tools/google_api_tool/googleapi_to_openapi_converter.d.ts +5 -4
- package/dist/types/tools/google_api_tool/index.d.ts +4 -5
- package/dist/types/tools/load_artifacts_tool.d.ts +14 -1
- package/dist/types/tools/load_memory_tool.d.ts +23 -1
- package/dist/types/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.d.ts +12 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +8 -0
- package/dist/types/tools/openapi_tool/openapi_toolset.d.ts +5 -0
- package/dist/types/tools/openapi_tool/rest_api_tool.d.ts +10 -0
- package/dist/types/tools/toolbox_toolset.d.ts +159 -0
- package/dist/types/utils/client_labels.d.ts +2 -1
- package/dist/types/utils/gemini_schema_util.d.ts +8 -0
- package/dist/types/utils/output_schema_utils.d.ts +3 -2
- package/dist/types/utils/simple_zod_to_json.d.ts +1 -2
- package/dist/types/version.d.ts +1 -1
- package/dist/web/index_web.js +74 -66
- package/dist/web/index_web.js.map +4 -4
- package/package.json +34 -27
- package/dist/cjs/agents/remote_agent.js +0 -187
- package/dist/cjs/tools/crewai_tool.js +0 -132
- package/dist/cjs/tools/google_api_tool/google_api_tool_set.js +0 -226
- package/dist/cjs/tools/google_api_tool/google_api_tool_sets.js +0 -58
- package/dist/cjs/tools/langchain_tool.js +0 -172
- package/dist/cjs/tools/toolbox_tool.js +0 -108
- package/dist/esm/agents/remote_agent.js +0 -164
- package/dist/esm/tools/crewai_tool.js +0 -107
- package/dist/esm/tools/google_api_tool/google_api_tool_set.js +0 -188
- package/dist/esm/tools/google_api_tool/google_api_tool_sets.js +0 -24
- package/dist/esm/tools/langchain_tool.js +0 -148
- package/dist/esm/tools/toolbox_tool.js +0 -80
- package/dist/types/agents/remote_agent.d.ts +0 -68
- package/dist/types/tools/crewai_tool.d.ts +0 -85
- package/dist/types/tools/google_api_tool/google_api_tool_set.d.ts +0 -78
- package/dist/types/tools/google_api_tool/google_api_tool_sets.d.ts +0 -33
- package/dist/types/tools/langchain_tool.d.ts +0 -103
- package/dist/types/tools/toolbox_tool.d.ts +0 -73
|
@@ -56,6 +56,17 @@ export interface ContainerCodeExecutorOptions {
|
|
|
56
56
|
* can be re-enabled via `networkEnabled: true` when the executed code is
|
|
57
57
|
* trusted.
|
|
58
58
|
*
|
|
59
|
+
* A separate container is started per session (keyed on `appName`, `userId`,
|
|
60
|
+
* and `session.id` from `ExecuteCodeParams.invocationContext`) rather than
|
|
61
|
+
* one container shared across every call: `codeExecutor` is a single
|
|
62
|
+
* property set once on an `LlmAgent` instance, and that instance is the
|
|
63
|
+
* long-lived object serving every session the agent handles, so a single
|
|
64
|
+
* shared container would let one session's files, environment, and
|
|
65
|
+
* background processes persist into a later, unrelated session's execution.
|
|
66
|
+
* A container is still reused across multiple calls *within* the same
|
|
67
|
+
* session, so the per-call container-startup cost is paid once per session,
|
|
68
|
+
* not once per call.
|
|
69
|
+
*
|
|
59
70
|
* Limitations: this executor runs a code string only. `inputFiles` and `args`
|
|
60
71
|
* on the request are not copied into the container, and output files are not
|
|
61
72
|
* collected (`outputFiles` is always empty), so tools that stage resource
|
|
@@ -67,8 +78,8 @@ export declare class ContainerCodeExecutor extends BaseCodeExecutor {
|
|
|
67
78
|
private readonly dockerPath?;
|
|
68
79
|
private readonly containerOptions;
|
|
69
80
|
private readonly timeoutSeconds;
|
|
70
|
-
private
|
|
71
|
-
private
|
|
81
|
+
private readonly containers;
|
|
82
|
+
private readonly initPromises;
|
|
72
83
|
constructor(options?: ContainerCodeExecutorOptions);
|
|
73
84
|
executeCode(params: ExecuteCodeParams): Promise<CodeExecutionResult>;
|
|
74
85
|
/**
|
|
@@ -79,11 +90,12 @@ export declare class ContainerCodeExecutor extends BaseCodeExecutor {
|
|
|
79
90
|
*/
|
|
80
91
|
private describeExit;
|
|
81
92
|
/**
|
|
82
|
-
* Stops and removes
|
|
83
|
-
* started; provided for deterministic teardown in tests and app
|
|
93
|
+
* Stops and removes every session's container. Safe to call when none has
|
|
94
|
+
* been started; provided for deterministic teardown in tests and app
|
|
95
|
+
* shutdown.
|
|
84
96
|
*/
|
|
85
97
|
close(): Promise<void>;
|
|
86
|
-
/** Lazily builds/starts the container exactly once. */
|
|
98
|
+
/** Lazily builds/starts the given session's container exactly once. */
|
|
87
99
|
private ensureContainer;
|
|
88
100
|
private initContainer;
|
|
89
101
|
}
|
package/dist/types/common.d.ts
CHANGED
|
@@ -27,8 +27,6 @@ export { CONTENT_REQUEST_PROCESSOR, ContentRequestProcessor, } from './agents/pr
|
|
|
27
27
|
export { ContextCompactorRequestProcessor } from './agents/processors/context_compactor_request_processor.js';
|
|
28
28
|
export { INTERACTIONS_REQUEST_PROCESSOR, InteractionsRequestProcessor, } from './agents/processors/interactions_request_processor.js';
|
|
29
29
|
export { ReadonlyContext } from './agents/readonly_context.js';
|
|
30
|
-
export { RemoteAgent, isRemoteAgent } from './agents/remote_agent.js';
|
|
31
|
-
export type { RemoteAgentConfig, RemoteAgentFetch, } from './agents/remote_agent.js';
|
|
32
30
|
export { RoutedAgent, isRoutedAgent } from './agents/routed_agent.js';
|
|
33
31
|
export type { AgentRouter, RoutedAgentConfig } from './agents/routed_agent.js';
|
|
34
32
|
export { StreamingMode, createRunConfig } from './agents/run_config.js';
|
|
@@ -192,7 +190,8 @@ export type { Logger } from './utils/logger.js';
|
|
|
192
190
|
export { isGemini2OrAbove, isGemini35LiveTranslate, isGemini3xFlashLive, isGemini3xLive, } from './utils/model_name.js';
|
|
193
191
|
export { toJsonSchema } from './utils/schema.js';
|
|
194
192
|
export type { SchemaLike } from './utils/schema.js';
|
|
195
|
-
export { zodObjectToSchema } from './utils/simple_zod_to_json.js';
|
|
193
|
+
export { isZodObject, isZodSchema, zodObjectToSchema, } from './utils/simple_zod_to_json.js';
|
|
194
|
+
export type { ZodSchema } from './utils/simple_zod_to_json.js';
|
|
196
195
|
export { Task } from './utils/task.js';
|
|
197
196
|
export type { TaskExecutable } from './utils/task.js';
|
|
198
197
|
export { GoogleLLMVariant } from './utils/variant_utils.js';
|
|
@@ -218,12 +217,9 @@ export * from './sessions/base_session_service.js';
|
|
|
218
217
|
export * from './tools/base_tool.js';
|
|
219
218
|
export { convertSessionToEvalFormat, createEmptyState, } from './cli/utils/evals.js';
|
|
220
219
|
export type { EvaluationItem, IntermediateAgentResponseItem, ToolUseItem, } from './cli/utils/evals.js';
|
|
221
|
-
export { CrewaiTool, isCrewaiTool } from './tools/crewai_tool.js';
|
|
222
|
-
export type { CrewaiSchemaLike, CrewaiToolConfig, CrewaiToolLike, } from './tools/crewai_tool.js';
|
|
223
220
|
export { buildFunctionDeclarationForLangchain, buildFunctionDeclarationForParamsForCrewai, buildFunctionDeclarationUtil, } from './tools/function_tool.js';
|
|
224
221
|
export type { CallLiveToolRequest } from './tools/function_tool.js';
|
|
225
|
-
export {
|
|
226
|
-
export type { LangchainSchemaLike, LangchainToolConfig, LangchainToolLike, } from './tools/langchain_tool.js';
|
|
222
|
+
export type { LoadMemoryResponse, LoadMemoryToolOptions, } from './tools/load_memory_tool.js';
|
|
227
223
|
export { isBaseRetrievalTool } from './tools/retrieval/base_retrieval_tool.js';
|
|
228
|
-
export {
|
|
229
|
-
export type {
|
|
224
|
+
export { ToolboxToolset, isToolboxToolset } from './tools/toolbox_toolset.js';
|
|
225
|
+
export type { ToolboxLoadOptions, ToolboxToolLike, ToolboxToolsetClientLike, ToolboxToolsetOptions, } from './tools/toolbox_toolset.js';
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
export declare class InputValidationError extends Error {
|
|
10
10
|
/**
|
|
11
11
|
* @param message A message describing why the input is invalid.
|
|
12
|
+
* @param options Standard error options, e.g. `{cause}`.
|
|
12
13
|
*/
|
|
13
|
-
constructor(message?: string);
|
|
14
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
14
15
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,7 +21,8 @@ export type { VertexAiMemoryBankServiceOptions } from './memory/vertex_ai_memory
|
|
|
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
23
|
export { DebugLoggingPlugin, isDebugLoggingPlugin, } from './plugins/debug_logging_plugin.js';
|
|
24
|
-
export { DatabaseSessionService } from './sessions/database_session_service.js';
|
|
24
|
+
export { DatabaseSessionService, isStaleSessionError, StaleSessionError, } from './sessions/database_session_service.js';
|
|
25
|
+
export type { DatabaseSessionServiceOptions } from './sessions/database_session_service.js';
|
|
25
26
|
export { getSessionServiceFromUri } from './sessions/registry.js';
|
|
26
27
|
export { VertexAiSessionService } from './sessions/vertex_ai_session_service.js';
|
|
27
28
|
export type { VertexAiCreateSessionRequest, VertexAiSessionServiceOptions, } from './sessions/vertex_ai_session_service.js';
|
|
@@ -34,6 +35,7 @@ export { SecretManagerClient, type SecretManagerClientOptions, } from './tools/a
|
|
|
34
35
|
export { ApplicationIntegrationToolset, type ApplicationIntegrationToolsetOptions, } from './tools/application_integration_tool/application_integration_toolset.js';
|
|
35
36
|
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
37
|
export { IntegrationClient, type IntegrationClientOptions, } from './tools/application_integration_tool/clients/integration_client.js';
|
|
38
|
+
export { IntegrationConnectorTool, type IntegrationConnectorToolOptions, } from './tools/application_integration_tool/integration_connector_tool.js';
|
|
37
39
|
export { LOAD_WEB_PAGE, loadWebPage } from './tools/load_web_page.js';
|
|
38
40
|
export type { LoadWebPageOptions } from './tools/load_web_page.js';
|
|
39
41
|
export { credentialToParam, dictToAuthScheme, INTERNAL_AUTH_PREFIX, openidDictToSchemeCredential, openidUrlToSchemeCredential, serviceAccountDictToSchemeCredential, serviceAccountSchemeCredential, tokenToSchemeCredential, } from './tools/openapi_tool/auth/auth_helpers.js';
|
|
@@ -68,6 +70,6 @@ export * from './tools/google_api_tool/index.js';
|
|
|
68
70
|
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
71
|
export type { AddSessionToEvalSetRequest, EvalEntry, EvalInitialSession, EvalMetric, EvalMetricResult, EvalResult, EvalSetItem, InvocationEvalMetricResult, RunEvalRequest, RunEvalResult, RunEvalsOptions, } from './cli/cli_eval.js';
|
|
70
72
|
export { loadDotenvForAgent, walkToRootUntilFound } from './cli/utils/envs.js';
|
|
71
|
-
export { LOGGING_FORMAT,
|
|
73
|
+
export { LOGGING_FORMAT, logToTmpFolder, setupAdkLogger, } from './cli/utils/logs.js';
|
|
72
74
|
export type { LogToTmpFolderOptions } from './cli/utils/logs.js';
|
|
73
75
|
export * from './tools/mcp/index.js';
|
|
@@ -375,16 +375,6 @@ export declare abstract class BasePlugin {
|
|
|
375
375
|
toolContext: Context;
|
|
376
376
|
result: Record<string, unknown>;
|
|
377
377
|
}): Promise<Record<string, unknown> | undefined>;
|
|
378
|
-
/**
|
|
379
|
-
* Callback executed when a tool call encounters an error.
|
|
380
|
-
tool: BaseTool;
|
|
381
|
-
toolArgs: Record<string, unknown>;
|
|
382
|
-
toolContext: Context;
|
|
383
|
-
result: Record<string, unknown>;
|
|
384
|
-
}): Promise<Record<string, unknown> | undefined> {
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
378
|
/**
|
|
389
379
|
* Callback executed when a tool call encounters an error.
|
|
390
380
|
*
|
|
@@ -139,6 +139,11 @@ export declare abstract class BaseSessionService {
|
|
|
139
139
|
*/
|
|
140
140
|
private updateSessionState;
|
|
141
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* Places `event` into `session.events`, replacing the entry with the same id
|
|
144
|
+
* if one is already there and appending it otherwise.
|
|
145
|
+
*/
|
|
146
|
+
export declare function upsertSessionEvent(session: Session, event: Event): void;
|
|
142
147
|
/**
|
|
143
148
|
* Removes temporary state delta keys from the event.
|
|
144
149
|
*/
|
|
@@ -7,6 +7,21 @@ import type { MikroORMOptions as MikroDBOptions } from './db/operations.js';
|
|
|
7
7
|
import { Event } from '../events/event.js';
|
|
8
8
|
import { AppendEventRequest, BaseSessionService, CreateSessionRequest, DeleteSessionRequest, GetSessionRequest, ListSessionsRequest, ListSessionsResponse } from './base_session_service.js';
|
|
9
9
|
import { Session } from './session.js';
|
|
10
|
+
export { isStaleSessionError, StaleSessionError } from './stale_session_error.js';
|
|
11
|
+
/**
|
|
12
|
+
* Options for configuring {@link DatabaseSessionService}.
|
|
13
|
+
*/
|
|
14
|
+
export interface DatabaseSessionServiceOptions extends MikroDBOptions {
|
|
15
|
+
/**
|
|
16
|
+
* How to handle stale sessions in {@link DatabaseSessionService.appendEvent}.
|
|
17
|
+
*
|
|
18
|
+
* - `'reject'` (default): throws a {@link StaleSessionError} without persisting changes.
|
|
19
|
+
* - `'reload'`: reloads stored events and state into the session object after writing.
|
|
20
|
+
*
|
|
21
|
+
* @deprecated 'reload' is deprecated and will be removed in a future release. Use 'reject' (the default) and re-read the session with `getSession` to retry.
|
|
22
|
+
*/
|
|
23
|
+
staleSession?: 'reject' | 'reload';
|
|
24
|
+
}
|
|
10
25
|
/**
|
|
11
26
|
* Checks if a URI is a database connection URI.
|
|
12
27
|
*
|
|
@@ -22,7 +37,8 @@ export declare class DatabaseSessionService extends BaseSessionService {
|
|
|
22
37
|
private initialized;
|
|
23
38
|
private options?;
|
|
24
39
|
private connectionString?;
|
|
25
|
-
|
|
40
|
+
private readonly staleSession;
|
|
41
|
+
constructor(connectionStringOrOptions: DatabaseSessionServiceOptions | string, options?: DatabaseSessionServiceOptions);
|
|
26
42
|
init(): Promise<void>;
|
|
27
43
|
createSession({ appName, userId, state, sessionId, }: CreateSessionRequest): Promise<Session>;
|
|
28
44
|
getSession({ appName, userId, sessionId, config, }: GetSessionRequest): Promise<Session | undefined>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
declare const STALE_SESSION_ERROR_SIGNATURE_SYMBOL: unique symbol;
|
|
7
|
+
/**
|
|
8
|
+
* Error thrown when a session write loses an optimistic concurrency race.
|
|
9
|
+
*/
|
|
10
|
+
export declare class StaleSessionError extends Error {
|
|
11
|
+
readonly [STALE_SESSION_ERROR_SIGNATURE_SYMBOL] = true;
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Type guard for {@link StaleSessionError}.
|
|
16
|
+
*
|
|
17
|
+
* @param obj The value to check.
|
|
18
|
+
* @returns True if obj is a {@link StaleSessionError}.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isStaleSessionError(obj: unknown): obj is StaleSessionError;
|
|
21
|
+
export {};
|
|
@@ -9,7 +9,7 @@ import { Frontmatter, Skill } from './skill.js';
|
|
|
9
9
|
*
|
|
10
10
|
* @param content - The raw content of the SKILL.md file.
|
|
11
11
|
* @returns An object containing the parsed frontmatter and the remaining markdown body.
|
|
12
|
-
* @throws {
|
|
12
|
+
* @throws {InputValidationError} If the content is not properly formatted with YAML frontmatter.
|
|
13
13
|
*/
|
|
14
14
|
export declare function parseSkillMdContent(content: string): {
|
|
15
15
|
frontmatter: Frontmatter;
|
|
@@ -44,7 +44,8 @@ export declare function loadAllSkillsInDir(skillsBasePath: string): Promise<Reco
|
|
|
44
44
|
*
|
|
45
45
|
* @param zipBuffer - The raw Buffer of the zip file containing the skill.
|
|
46
46
|
* @returns A Skill object with all components loaded.
|
|
47
|
-
* @throws {
|
|
47
|
+
* @throws {NotFoundError} If the archive has no SKILL.md.
|
|
48
|
+
* @throws {InputValidationError} If a member name is a traversal path,
|
|
48
49
|
* or if the skill name is missing or is not a bare path segment.
|
|
49
50
|
*/
|
|
50
51
|
export declare function loadSkillFromZipBuffer(zipBuffer: Buffer): Skill;
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* constructs of the framework that are not observable by the SDK.
|
|
15
15
|
*/
|
|
16
16
|
import { Content } from '@google/genai';
|
|
17
|
-
import { Context } from '@opentelemetry/api';
|
|
17
|
+
import { Context, Span } from '@opentelemetry/api';
|
|
18
18
|
import { BaseAgent } from '../agents/base_agent.js';
|
|
19
19
|
import { InvocationContext } from '../agents/invocation_context.js';
|
|
20
20
|
import { Event } from '../events/event.js';
|
|
@@ -62,15 +62,29 @@ export declare function traceNodeExecution({ nodePath, runId, attempt, status, i
|
|
|
62
62
|
export interface TraceToolCallParams {
|
|
63
63
|
tool: BaseTool;
|
|
64
64
|
args: Record<string, unknown>;
|
|
65
|
-
functionResponseEvent
|
|
65
|
+
functionResponseEvent?: Event;
|
|
66
|
+
/** The exception raised while executing the tool, if any. */
|
|
67
|
+
error?: unknown;
|
|
68
|
+
/** An error type reported by a tool response instead of a thrown error. */
|
|
69
|
+
errorType?: string;
|
|
70
|
+
/** The tool execution span. Defaults to the active span when omitted. */
|
|
71
|
+
span?: Span;
|
|
66
72
|
invocationContext: InvocationContext;
|
|
67
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Resolves a stable error classification suitable for the OpenTelemetry
|
|
76
|
+
* `error.type` attribute without using the potentially sensitive error message.
|
|
77
|
+
*
|
|
78
|
+
* @param error The thrown value.
|
|
79
|
+
* @returns The explicit ADK error type, GenAI API status, or error class name.
|
|
80
|
+
*/
|
|
81
|
+
export declare function resolveErrorType(error: unknown): string;
|
|
68
82
|
/**
|
|
69
83
|
* Traces tool call.
|
|
70
84
|
*
|
|
71
85
|
* @param params The parameters object containing tool, args, and function response event.
|
|
72
86
|
*/
|
|
73
|
-
export declare function traceToolCall(
|
|
87
|
+
export declare function traceToolCall(params: TraceToolCallParams): void;
|
|
74
88
|
export interface TraceMergedToolCallsParams {
|
|
75
89
|
responseEventId: string;
|
|
76
90
|
functionResponseEvent: Event;
|
|
@@ -7,8 +7,7 @@ import { OpenAPIV3 } from 'openapi-types';
|
|
|
7
7
|
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
8
8
|
import { AuthCredential } from '../../auth/auth_credential.js';
|
|
9
9
|
import { BaseTool } from '../base_tool.js';
|
|
10
|
-
import { BaseToolset } from '../base_toolset.js';
|
|
11
|
-
import { RestApiTool } from '../openapi_tool/rest_api_tool.js';
|
|
10
|
+
import { BaseToolset, ToolPredicate } from '../base_toolset.js';
|
|
12
11
|
import { BaseAPIHubClient } from './clients/apihub_client.js';
|
|
13
12
|
/** Options for {@link APIHubToolset}. */
|
|
14
13
|
export interface APIHubToolsetOptions {
|
|
@@ -44,8 +43,8 @@ export interface APIHubToolsetOptions {
|
|
|
44
43
|
*/
|
|
45
44
|
description?: string;
|
|
46
45
|
/**
|
|
47
|
-
* When true, the spec is fetched on the first call to `getTools`
|
|
48
|
-
*
|
|
46
|
+
* When true, the spec is fetched on the first call to `getTools`
|
|
47
|
+
* instead of when the toolset is constructed.
|
|
49
48
|
*/
|
|
50
49
|
lazyLoadSpec?: boolean;
|
|
51
50
|
/** Auth scheme applied to every tool the spec produces. */
|
|
@@ -57,13 +56,18 @@ export interface APIHubToolsetOptions {
|
|
|
57
56
|
* built from `accessToken` and `serviceAccountJson`.
|
|
58
57
|
*/
|
|
59
58
|
apihubClient?: BaseAPIHubClient;
|
|
59
|
+
/**
|
|
60
|
+
* Filter selecting which tools from the spec are exposed by `getTools`.
|
|
61
|
+
* Accepts a list of tool names or a {@link ToolPredicate} function.
|
|
62
|
+
*/
|
|
63
|
+
toolFilter?: ToolPredicate | string[];
|
|
60
64
|
}
|
|
61
65
|
/**
|
|
62
66
|
* Builds one tool per operation of an API registered in API Hub.
|
|
63
67
|
*
|
|
64
68
|
* The toolset fetches an OpenAPI spec from API Hub, parses it as YAML or JSON,
|
|
65
69
|
* and hands it to an {@link OpenAPIToolset}, which produces a
|
|
66
|
-
*
|
|
70
|
+
* `RestApiTool` for each operation.
|
|
67
71
|
*
|
|
68
72
|
* ```ts
|
|
69
73
|
* const toolset = new APIHubToolset({
|
|
@@ -79,11 +83,11 @@ export interface APIHubToolsetOptions {
|
|
|
79
83
|
*
|
|
80
84
|
* By default the spec is fetched when the toolset is constructed. A
|
|
81
85
|
* constructor cannot wait for the request, so a failure is reported by the
|
|
82
|
-
* first call to `getTools
|
|
86
|
+
* first call to `getTools`, and every later call reports the same
|
|
83
87
|
* failure.
|
|
84
88
|
*
|
|
85
|
-
* With `lazyLoadSpec`, the spec is fetched on the first call to `getTools
|
|
86
|
-
*
|
|
89
|
+
* With `lazyLoadSpec`, the spec is fetched on the first call to `getTools`.
|
|
90
|
+
* A successful result is kept, including a spec that produced no
|
|
87
91
|
* tools. A failed fetch is not kept, so the next call fetches again.
|
|
88
92
|
*/
|
|
89
93
|
export declare class APIHubToolset extends BaseToolset {
|
|
@@ -91,8 +95,8 @@ export declare class APIHubToolset extends BaseToolset {
|
|
|
91
95
|
name: string;
|
|
92
96
|
/** The toolset description, filled in from the spec when empty. */
|
|
93
97
|
description: string;
|
|
94
|
-
readonly apihubResourceName
|
|
95
|
-
readonly lazyLoadSpec
|
|
98
|
+
private readonly apihubResourceName;
|
|
99
|
+
private readonly lazyLoadSpec;
|
|
96
100
|
private readonly apihubClient;
|
|
97
101
|
private readonly authScheme?;
|
|
98
102
|
private readonly authCredential?;
|
|
@@ -105,17 +109,6 @@ export declare class APIHubToolset extends BaseToolset {
|
|
|
105
109
|
* @throws When the spec cannot be fetched or is not valid YAML or JSON.
|
|
106
110
|
*/
|
|
107
111
|
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
108
|
-
/**
|
|
109
|
-
* Returns the tool with the given name, or `undefined` when the spec
|
|
110
|
-
* produced no such tool.
|
|
111
|
-
*
|
|
112
|
-
* Unlike `OpenAPIToolset.getTool`, the result is a Promise, because the spec
|
|
113
|
-
* may still be loading.
|
|
114
|
-
*
|
|
115
|
-
* @param name The tool name, which is the operation ID in snake_case.
|
|
116
|
-
* @throws When the spec cannot be fetched or is not valid YAML or JSON.
|
|
117
|
-
*/
|
|
118
|
-
getTool(name: string): Promise<RestApiTool | undefined>;
|
|
119
112
|
close(): Promise<void>;
|
|
120
113
|
private loadToolset;
|
|
121
114
|
private prepareTools;
|
|
@@ -3,18 +3,26 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
import { ReadonlyContext } from '../../agents/readonly_context.js';
|
|
7
|
+
import { AuthCredential } from '../../auth/auth_credential.js';
|
|
8
|
+
import { AuthScheme } from '../../auth/auth_schemes.js';
|
|
6
9
|
import { BaseTool } from '../base_tool.js';
|
|
7
|
-
import { BaseToolset } from '../base_toolset.js';
|
|
10
|
+
import { BaseToolset, ToolPredicate } from '../base_toolset.js';
|
|
11
|
+
import { IntegrationConnectorTool, type IntegrationConnectorToolOptions } from './integration_connector_tool.js';
|
|
12
|
+
export { IntegrationConnectorTool, type IntegrationConnectorToolOptions };
|
|
8
13
|
/** Options of {@link ApplicationIntegrationToolset}. */
|
|
9
14
|
export interface ApplicationIntegrationToolsetOptions {
|
|
10
15
|
/** The Google Cloud project ID. */
|
|
11
16
|
project: string;
|
|
12
17
|
/** The Google Cloud location, such as `us-central1`. */
|
|
13
18
|
location: string;
|
|
14
|
-
/** The integration name. Set it together with `
|
|
19
|
+
/** The integration name. Set it together with `triggers` or alone for all triggers. */
|
|
15
20
|
integration?: string;
|
|
16
|
-
/**
|
|
17
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The API trigger IDs of the integration, such as
|
|
23
|
+
* `['api_trigger/my_trigger']`.
|
|
24
|
+
*/
|
|
25
|
+
triggers?: string[];
|
|
18
26
|
/**
|
|
19
27
|
* The Integration Connectors connection name. Set it together with
|
|
20
28
|
* `entityOperations`, `actions`, or both.
|
|
@@ -29,7 +37,7 @@ export interface ApplicationIntegrationToolsetOptions {
|
|
|
29
37
|
/** Connection actions to expose, such as `['ExecuteCustomQuery']`. */
|
|
30
38
|
actions?: string[];
|
|
31
39
|
/** Prefix of every generated tool name. Defaults to `''`. */
|
|
32
|
-
|
|
40
|
+
toolNamePrefix?: string;
|
|
33
41
|
/** Text appended to every generated tool description. Defaults to `''`. */
|
|
34
42
|
toolInstructions?: string;
|
|
35
43
|
/**
|
|
@@ -38,6 +46,20 @@ export interface ApplicationIntegrationToolsetOptions {
|
|
|
38
46
|
* Default Credentials.
|
|
39
47
|
*/
|
|
40
48
|
serviceAccountJson?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Authentication scheme for dynamic end-user credentials on connection tools,
|
|
51
|
+
* when `authOverrideEnabled` is enabled on the connection.
|
|
52
|
+
*/
|
|
53
|
+
authScheme?: AuthScheme;
|
|
54
|
+
/**
|
|
55
|
+
* Authentication credential for dynamic end-user credentials on connection
|
|
56
|
+
* tools, when `authOverrideEnabled` is enabled on the connection.
|
|
57
|
+
*/
|
|
58
|
+
authCredential?: AuthCredential;
|
|
59
|
+
/**
|
|
60
|
+
* Filter used to select which generated tools are exposed by `getTools`.
|
|
61
|
+
*/
|
|
62
|
+
toolFilter?: ToolPredicate | string[];
|
|
41
63
|
}
|
|
42
64
|
/**
|
|
43
65
|
* A toolset generated from a Google Cloud Application Integration API trigger,
|
|
@@ -53,7 +75,7 @@ export interface ApplicationIntegrationToolsetOptions {
|
|
|
53
75
|
* project: 'my-project',
|
|
54
76
|
* location: 'us-central1',
|
|
55
77
|
* integration: 'my-integration',
|
|
56
|
-
*
|
|
78
|
+
* triggers: ['api_trigger/my_trigger'],
|
|
57
79
|
* });
|
|
58
80
|
*
|
|
59
81
|
* @example
|
|
@@ -69,9 +91,10 @@ export interface ApplicationIntegrationToolsetOptions {
|
|
|
69
91
|
export declare class ApplicationIntegrationToolset extends BaseToolset {
|
|
70
92
|
private readonly options;
|
|
71
93
|
private toolsPromise?;
|
|
94
|
+
private openApiToolsets;
|
|
72
95
|
/**
|
|
73
|
-
* @throws Error Unless the options name either an integration
|
|
74
|
-
*
|
|
96
|
+
* @throws Error Unless the options name either an integration, or a
|
|
97
|
+
* connection with at least one entity operation or action.
|
|
75
98
|
*/
|
|
76
99
|
constructor(options: ApplicationIntegrationToolsetOptions);
|
|
77
100
|
/**
|
|
@@ -80,7 +103,7 @@ export declare class ApplicationIntegrationToolset extends BaseToolset {
|
|
|
80
103
|
* The first call fetches the spec and builds the tools. Concurrent calls
|
|
81
104
|
* share that load. When it fails, the next call tries again.
|
|
82
105
|
*/
|
|
83
|
-
getTools(): Promise<BaseTool[]>;
|
|
106
|
+
getTools(context?: ReadonlyContext): Promise<BaseTool[]>;
|
|
84
107
|
close(): Promise<void>;
|
|
85
108
|
private loadTools;
|
|
86
109
|
}
|
|
@@ -21,6 +21,8 @@ export interface ConnectionsClientOptions {
|
|
|
21
21
|
}
|
|
22
22
|
/** Service details of an Integration Connectors connection. */
|
|
23
23
|
export interface ConnectionDetails {
|
|
24
|
+
/** The resource name of the connection, or `''` when not reported. */
|
|
25
|
+
name?: string;
|
|
24
26
|
/**
|
|
25
27
|
* The Service Directory name of the connection. For a connection with a
|
|
26
28
|
* `host`, the TLS Service Directory name.
|
|
@@ -159,17 +161,29 @@ export declare function updateOperation(options: EntityOperationOptions): JsonOb
|
|
|
159
161
|
*/
|
|
160
162
|
export declare function deleteOperation(options: EntityOperationOptions): JsonObject;
|
|
161
163
|
/** Builds the request schema of the create operation of an entity. */
|
|
162
|
-
export declare function createOperationRequest(entity: string
|
|
164
|
+
export declare function createOperationRequest(entity: string, options?: {
|
|
165
|
+
includeDynamicAuthConfig?: boolean;
|
|
166
|
+
}): JsonObject;
|
|
163
167
|
/** Builds the request schema of the update operation of an entity. */
|
|
164
|
-
export declare function updateOperationRequest(entity: string
|
|
168
|
+
export declare function updateOperationRequest(entity: string, options?: {
|
|
169
|
+
includeDynamicAuthConfig?: boolean;
|
|
170
|
+
}): JsonObject;
|
|
165
171
|
/** Builds the request schema of the get operation. */
|
|
166
|
-
export declare function getOperationRequest(
|
|
172
|
+
export declare function getOperationRequest(options?: {
|
|
173
|
+
includeDynamicAuthConfig?: boolean;
|
|
174
|
+
}): JsonObject;
|
|
167
175
|
/** Builds the request schema of the delete operation. */
|
|
168
|
-
export declare function deleteOperationRequest(
|
|
176
|
+
export declare function deleteOperationRequest(options?: {
|
|
177
|
+
includeDynamicAuthConfig?: boolean;
|
|
178
|
+
}): JsonObject;
|
|
169
179
|
/** Builds the request schema of the list operation. */
|
|
170
|
-
export declare function listOperationRequest(
|
|
180
|
+
export declare function listOperationRequest(options?: {
|
|
181
|
+
includeDynamicAuthConfig?: boolean;
|
|
182
|
+
}): JsonObject;
|
|
171
183
|
/** Builds the request schema of an action. */
|
|
172
|
-
export declare function actionRequest(action: string
|
|
184
|
+
export declare function actionRequest(action: string, options?: {
|
|
185
|
+
includeDynamicAuthConfig?: boolean;
|
|
186
|
+
}): JsonObject;
|
|
173
187
|
/** Builds the response schema of an action. */
|
|
174
188
|
export declare function actionResponse(action: string): JsonObject;
|
|
175
189
|
/** Builds the request schema of the `ExecuteCustomQuery` action. */
|
|
@@ -186,8 +200,8 @@ export declare class ConnectionsClient {
|
|
|
186
200
|
private readonly tokenSource;
|
|
187
201
|
constructor(options: ConnectionsClientOptions);
|
|
188
202
|
/**
|
|
189
|
-
* Reads the service name and host of the connection, and
|
|
190
|
-
* an authentication override.
|
|
203
|
+
* Reads the resource name, service name and host of the connection, and
|
|
204
|
+
* whether it allows an authentication override.
|
|
191
205
|
*/
|
|
192
206
|
getConnectionDetails(): Promise<ConnectionDetails>;
|
|
193
207
|
/**
|
|
@@ -13,8 +13,8 @@ export interface IntegrationClientOptions {
|
|
|
13
13
|
location: string;
|
|
14
14
|
/** The integration name. */
|
|
15
15
|
integration?: string;
|
|
16
|
-
/** The API trigger
|
|
17
|
-
|
|
16
|
+
/** The API trigger IDs of the integration. */
|
|
17
|
+
triggers?: string[];
|
|
18
18
|
/** The connection name. */
|
|
19
19
|
connection?: string;
|
|
20
20
|
/**
|
|
@@ -41,7 +41,7 @@ export declare class IntegrationClient {
|
|
|
41
41
|
private readonly project;
|
|
42
42
|
private readonly location;
|
|
43
43
|
private readonly integration?;
|
|
44
|
-
private readonly
|
|
44
|
+
private readonly triggers?;
|
|
45
45
|
private readonly connection?;
|
|
46
46
|
private readonly entityOperations;
|
|
47
47
|
private readonly actions;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { FunctionDeclaration } from '@google/genai';
|
|
7
|
+
import { AuthCredential } from '../../auth/auth_credential.js';
|
|
8
|
+
import { AuthScheme } from '../../auth/auth_schemes.js';
|
|
9
|
+
import { BaseTool, BaseToolParams, RunAsyncToolRequest } from '../base_tool.js';
|
|
10
|
+
import { RestApiTool } from '../openapi_tool/rest_api_tool.js';
|
|
11
|
+
/** Options for {@link IntegrationConnectorTool}. */
|
|
12
|
+
export interface IntegrationConnectorToolOptions extends BaseToolParams {
|
|
13
|
+
/** The Integration Connectors connection resource name. */
|
|
14
|
+
connectionName: string;
|
|
15
|
+
/** The host of the connection, or `''` when it has none. */
|
|
16
|
+
connectionHost: string;
|
|
17
|
+
/** The Service Directory name of the connection. */
|
|
18
|
+
connectionServiceName: string;
|
|
19
|
+
/** The Integration Connectors entity targeted by the tool, if any. */
|
|
20
|
+
entity?: string;
|
|
21
|
+
/** The connector operation executed by the tool, if any. */
|
|
22
|
+
operation?: string;
|
|
23
|
+
/** The connector action executed by the tool, if any. */
|
|
24
|
+
action?: string;
|
|
25
|
+
/** The underlying {@link RestApiTool} that executes the HTTP request. */
|
|
26
|
+
restApiTool: RestApiTool;
|
|
27
|
+
/** The authentication scheme for dynamic end-user credentials, if any. */
|
|
28
|
+
authScheme?: AuthScheme;
|
|
29
|
+
/** The authentication credential for dynamic end-user credentials, if any. */
|
|
30
|
+
authCredential?: AuthCredential;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Wraps a {@link RestApiTool} for an Integration Connectors operation, hiding
|
|
34
|
+
* connection and routing fields from the model declaration and injecting them
|
|
35
|
+
* when the tool runs.
|
|
36
|
+
*/
|
|
37
|
+
export declare class IntegrationConnectorTool extends BaseTool {
|
|
38
|
+
/**
|
|
39
|
+
* Request fields that {@link IntegrationConnectorTool} injects at runtime and
|
|
40
|
+
* excludes from the function declaration shown to the model.
|
|
41
|
+
*/
|
|
42
|
+
static readonly EXCLUDE_FIELDS: readonly string[];
|
|
43
|
+
/**
|
|
44
|
+
* Request fields that {@link IntegrationConnectorTool} removes from the
|
|
45
|
+
* `required` list in the function declaration shown to the model.
|
|
46
|
+
*/
|
|
47
|
+
static readonly OPTIONAL_FIELDS: readonly string[];
|
|
48
|
+
readonly connectionName: string;
|
|
49
|
+
readonly connectionHost: string;
|
|
50
|
+
readonly connectionServiceName: string;
|
|
51
|
+
readonly entity: string;
|
|
52
|
+
readonly operation: string;
|
|
53
|
+
readonly action: string;
|
|
54
|
+
readonly restApiTool: RestApiTool;
|
|
55
|
+
readonly authScheme?: AuthScheme;
|
|
56
|
+
readonly authCredential?: AuthCredential;
|
|
57
|
+
constructor(options: IntegrationConnectorToolOptions);
|
|
58
|
+
/**
|
|
59
|
+
* Returns the Gemini `FunctionDeclaration` with connection routing fields
|
|
60
|
+
* removed from `parameters.properties` and optional and excluded fields
|
|
61
|
+
* removed from `parameters.required`.
|
|
62
|
+
*/
|
|
63
|
+
_getDeclaration(): FunctionDeclaration;
|
|
64
|
+
/**
|
|
65
|
+
* Injects the connection details and the configured entity, operation, and
|
|
66
|
+
* action into a copy of `request.args` and delegates execution to the wrapped
|
|
67
|
+
* {@link RestApiTool}.
|
|
68
|
+
*/
|
|
69
|
+
runAsync(request: RunAsyncToolRequest): Promise<unknown>;
|
|
70
|
+
}
|
|
@@ -8,11 +8,12 @@ import { LlmRequest } from '../models/llm_request.js';
|
|
|
8
8
|
import { Context } from '../agents/context.js';
|
|
9
9
|
import { BaseTool } from './base_tool.js';
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* constructor and apply the predicate in getTools method.
|
|
11
|
+
* Decides whether a tool should be exposed to the LLM based on the tool and
|
|
12
|
+
* optional context.
|
|
14
13
|
*/
|
|
15
|
-
export type ToolPredicate =
|
|
14
|
+
export type ToolPredicate = {
|
|
15
|
+
bivariance(tool: BaseTool, readonlyContext?: ReadonlyContext): boolean;
|
|
16
|
+
}['bivariance'];
|
|
16
17
|
/**
|
|
17
18
|
* A unique symbol to identify ADK agent classes.
|
|
18
19
|
* Defined once and shared by all BaseTool instances.
|
|
@@ -55,7 +56,7 @@ export declare abstract class BaseToolset {
|
|
|
55
56
|
* @param context Context used to filter tools available to the agent.
|
|
56
57
|
* @return Whether the tool should be exposed to LLM.
|
|
57
58
|
*/
|
|
58
|
-
protected isToolSelected(tool: BaseTool, context
|
|
59
|
+
protected isToolSelected(tool: BaseTool, context?: ReadonlyContext): boolean;
|
|
59
60
|
/**
|
|
60
61
|
* Processes the outgoing LLM request for this toolset. This method will be
|
|
61
62
|
* called before each tool processes the llm request.
|
|
@@ -7,6 +7,13 @@ import { FunctionDeclaration } from '@google/genai';
|
|
|
7
7
|
import { BaseTool, RunAsyncToolRequest } from '../base_tool.js';
|
|
8
8
|
import { RestApiTool } from '../openapi_tool/rest_api_tool.js';
|
|
9
9
|
declare const GOOGLE_API_TOOL_SIGNATURE_SYMBOL: unique symbol;
|
|
10
|
+
/**
|
|
11
|
+
* Options for constructing a {@link GoogleApiTool}.
|
|
12
|
+
*/
|
|
13
|
+
export interface GoogleApiToolOptions {
|
|
14
|
+
clientId?: string;
|
|
15
|
+
clientSecret?: string;
|
|
16
|
+
}
|
|
10
17
|
/**
|
|
11
18
|
* Type guard to check if an object is an instance of {@link GoogleApiTool}.
|
|
12
19
|
*/
|
|
@@ -17,14 +24,14 @@ export declare function isGoogleApiTool(obj: unknown): obj is GoogleApiTool;
|
|
|
17
24
|
*/
|
|
18
25
|
export declare class GoogleApiTool extends BaseTool {
|
|
19
26
|
readonly [GOOGLE_API_TOOL_SIGNATURE_SYMBOL] = true;
|
|
20
|
-
readonly restApiTool
|
|
21
|
-
constructor(restApiTool: RestApiTool);
|
|
27
|
+
private readonly restApiTool;
|
|
28
|
+
constructor(restApiTool: RestApiTool, options?: GoogleApiToolOptions);
|
|
22
29
|
_getDeclaration(): FunctionDeclaration;
|
|
23
30
|
runAsync(request: RunAsyncToolRequest): Promise<unknown>;
|
|
24
31
|
/**
|
|
25
32
|
* Configures OpenID Connect OAuth2 client credentials on the underlying
|
|
26
33
|
* {@link RestApiTool}.
|
|
27
34
|
*/
|
|
28
|
-
configureAuth(clientId
|
|
35
|
+
configureAuth(clientId?: string, clientSecret?: string): void;
|
|
29
36
|
}
|
|
30
37
|
export {};
|