@google/adk 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/a2a/a2a_remote_agent.js +17 -2
- package/dist/cjs/a2a/a2a_remote_agent_utils.js +8 -4
- package/dist/cjs/a2a/agent_card.js +5 -81
- package/dist/cjs/a2a/agent_to_a2a.js +7 -0
- package/dist/cjs/a2a/event_converter_utils.js +10 -3
- package/dist/cjs/agents/agent_engine_client.js +282 -55
- package/dist/cjs/agents/base_agent.js +111 -68
- package/dist/cjs/agents/functions.js +62 -85
- package/dist/cjs/agents/instructions.js +7 -6
- package/dist/cjs/agents/invocation_context.js +2 -2
- package/dist/cjs/agents/llm_agent.js +105 -95
- package/dist/cjs/agents/processors/content_processor_utils.js +42 -15
- package/dist/cjs/agents/processors/content_request_processor.js +28 -11
- package/dist/cjs/agents/processors/context_compactor_request_processor.js +5 -1
- package/dist/cjs/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/cjs/agents/processors/nl_planning_processor.js +2 -1
- package/dist/cjs/artifacts/file_artifact_service.js +1 -1
- package/dist/cjs/cli/cli_eval.js +884 -17
- package/dist/cjs/cli/utils/cleanup.js +84 -0
- package/dist/cjs/cli/utils/envs.js +33 -2
- package/dist/cjs/cli/utils/evals.js +75 -8
- package/dist/cjs/cli/utils/logs.js +128 -9
- package/dist/cjs/cli/utils/path_validation.js +83 -0
- package/dist/cjs/code_executors/container_code_executor.js +158 -36
- package/dist/cjs/common.js +50 -12
- package/dist/cjs/context/compaction_utils.js +19 -0
- package/dist/cjs/events/event.js +7 -3
- package/dist/cjs/features/feature_registry.js +5 -0
- package/dist/cjs/index.js +29 -14
- package/dist/cjs/models/google_llm.js +33 -2
- package/dist/cjs/models/interactions_utils.js +3 -0
- package/dist/cjs/plugins/base_plugin.js +45 -21
- package/dist/cjs/plugins/plugin_manager.js +27 -0
- package/dist/cjs/runner/runner.js +306 -189
- package/dist/cjs/sessions/base_session_service.js +1 -4
- package/dist/cjs/sessions/database_session_service.js +191 -19
- package/dist/cjs/sessions/db/operations.js +70 -1
- package/dist/cjs/sessions/db/schema.js +4 -0
- package/dist/cjs/sessions/in_memory_session_service.js +2 -2
- package/dist/cjs/sessions/vertex_ai_session_service.js +11 -3
- package/dist/cjs/skills/loader.js +29 -28
- package/dist/cjs/telemetry/api/instrumentation.js +632 -0
- package/dist/cjs/telemetry/api/internal/common/accumulators.js +169 -0
- package/dist/cjs/telemetry/api/internal/common/attributes.js +131 -0
- package/dist/cjs/telemetry/api/internal/common/config.js +159 -0
- package/dist/cjs/telemetry/api/internal/common/error.js +98 -0
- package/dist/cjs/telemetry/api/internal/common/finish_reason.js +63 -0
- package/dist/cjs/telemetry/api/internal/common/genai_messages.js +217 -0
- package/dist/cjs/telemetry/api/internal/common/http_exchange.js +169 -0
- package/dist/cjs/telemetry/api/internal/common/provider_name.js +87 -0
- package/dist/cjs/telemetry/api/internal/common/redaction.js +148 -0
- package/dist/cjs/telemetry/api/internal/common/serialization.js +58 -0
- package/dist/cjs/telemetry/api/internal/common/token_usage.js +118 -0
- package/dist/cjs/telemetry/api/internal/logs/inference.js +50 -0
- package/dist/cjs/telemetry/api/internal/logs/logger.js +46 -0
- package/dist/cjs/telemetry/api/internal/logs/mcp.js +141 -0
- package/dist/cjs/telemetry/api/internal/metrics/agent.js +128 -0
- package/dist/cjs/telemetry/api/internal/metrics/inference_start_hook.js +56 -0
- package/dist/cjs/telemetry/api/internal/metrics/meters.js +189 -0
- package/dist/cjs/telemetry/api/internal/metrics/tool.js +147 -0
- package/dist/cjs/telemetry/api/internal/metrics/workflow.js +132 -0
- package/dist/cjs/telemetry/api/internal/trace/agent.js +52 -0
- package/dist/cjs/telemetry/api/internal/trace/compaction.js +78 -0
- package/dist/cjs/telemetry/api/internal/trace/inference.js +132 -0
- package/dist/cjs/telemetry/api/internal/trace/live.js +52 -0
- package/dist/cjs/telemetry/api/internal/trace/node.js +73 -0
- package/dist/cjs/telemetry/api/internal/trace/propagation.js +67 -0
- package/dist/cjs/telemetry/api/internal/trace/tool.js +122 -0
- package/dist/cjs/telemetry/api/internal/trace/tracer.js +77 -0
- package/dist/cjs/telemetry/api/internal/trace/workflow.js +77 -0
- package/dist/cjs/telemetry/export/agent_engine.js +90 -0
- package/dist/cjs/telemetry/export/agent_runtime.js +73 -0
- package/dist/cjs/telemetry/export/google_cloud.js +763 -0
- package/dist/cjs/telemetry/export/request_driven_metric_reader.js +303 -0
- package/dist/cjs/telemetry/{setup.js → export/setup.js} +72 -5
- package/dist/cjs/tools/agent_tool.js +9 -1
- package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +22 -34
- package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +60 -20
- package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +26 -10
- package/dist/cjs/tools/application_integration_tool/integration_connector_tool.js +14 -23
- package/dist/cjs/tools/base_toolset.js +1 -1
- package/dist/cjs/tools/computer_use/base_computer.js +125 -0
- package/dist/cjs/tools/computer_use/computer_use_actions.js +502 -0
- package/dist/cjs/tools/computer_use/computer_use_tool.js +244 -0
- package/dist/cjs/tools/computer_use/computer_use_toolset.js +360 -0
- package/dist/cjs/tools/function_tool.js +15 -5
- package/dist/cjs/tools/google_api_tool/google_api_toolset.js +3 -2
- package/dist/cjs/tools/google_api_tool/googleapi_to_openapi_converter.js +3 -1
- package/dist/cjs/tools/load_artifacts_tool.js +15 -5
- package/dist/cjs/tools/load_memory_tool.js +2 -5
- package/dist/cjs/tools/mcp/mcp_session_manager.js +23 -3
- package/dist/cjs/tools/mcp/mcp_tool.js +7 -3
- package/dist/cjs/tools/mcp/mcp_toolset.js +18 -6
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +30 -29
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
- package/dist/cjs/tools/openapi_tool/rest_api_tool.js +45 -14
- package/dist/cjs/tools/skill/load_skill_resource_tool.js +7 -0
- package/dist/cjs/tools/skill/load_skill_tool.js +3 -0
- package/dist/cjs/tools/skill/run_skill_script_tool.js +12 -2
- package/dist/cjs/tools/toolbox_toolset.js +47 -28
- package/dist/cjs/utils/async_queue.js +37 -3
- package/dist/cjs/utils/client_labels.js +9 -11
- package/dist/cjs/utils/env_aware_utils.js +13 -7
- package/dist/cjs/utils/error_utils.js +40 -2
- package/dist/cjs/utils/failover_utils.js +10 -9
- package/dist/cjs/utils/gemini_schema_util.js +125 -12
- package/dist/cjs/utils/id_provider.js +63 -0
- package/dist/cjs/utils/model_name.js +15 -0
- package/dist/cjs/utils/simple_zod_to_json.js +13 -31
- package/dist/cjs/utils/ssrf_guard.js +46 -16
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/workflow/index.js +2 -0
- package/dist/cjs/workflow/node_runner.js +24 -80
- package/dist/cjs/workflow/nodes/parallel_worker.js +18 -7
- package/dist/cjs/workflow/run_llm_agent_as_node.js +19 -14
- package/dist/cjs/workflow/utils/retry_utils.js +2 -2
- package/dist/cjs/workflow/workflow.js +12 -12
- package/dist/esm/a2a/a2a_remote_agent.js +23 -3
- package/dist/esm/a2a/a2a_remote_agent_utils.js +8 -4
- package/dist/esm/a2a/agent_card.js +5 -83
- package/dist/esm/a2a/agent_to_a2a.js +7 -0
- package/dist/esm/a2a/event_converter_utils.js +10 -3
- package/dist/esm/agents/agent_engine_client.js +293 -55
- package/dist/esm/agents/base_agent.js +111 -72
- package/dist/esm/agents/functions.js +67 -89
- package/dist/esm/agents/instructions.js +7 -6
- package/dist/esm/agents/invocation_context.js +2 -2
- package/dist/esm/agents/llm_agent.js +111 -100
- package/dist/esm/agents/processors/content_processor_utils.js +42 -15
- package/dist/esm/agents/processors/content_request_processor.js +28 -11
- package/dist/esm/agents/processors/context_compactor_request_processor.js +5 -1
- package/dist/esm/agents/processors/instructions_llm_request_processor.js +1 -1
- package/dist/esm/agents/processors/nl_planning_processor.js +2 -1
- package/dist/esm/artifacts/file_artifact_service.js +1 -1
- package/dist/esm/cli/cli_eval.js +880 -17
- package/dist/esm/cli/utils/cleanup.js +56 -0
- package/dist/esm/cli/utils/envs.js +33 -2
- package/dist/esm/cli/utils/evals.js +74 -8
- package/dist/esm/cli/utils/logs.js +128 -9
- package/dist/esm/cli/utils/path_validation.js +45 -0
- package/dist/esm/code_executors/container_code_executor.js +158 -36
- package/dist/esm/common.js +49 -6
- package/dist/esm/context/compaction_utils.js +19 -0
- package/dist/esm/events/event.js +7 -3
- package/dist/esm/features/feature_registry.js +5 -0
- package/dist/esm/index.js +27 -15
- package/dist/esm/models/google_llm.js +33 -2
- package/dist/esm/models/interactions_utils.js +3 -0
- package/dist/esm/plugins/base_plugin.js +45 -21
- package/dist/esm/plugins/plugin_manager.js +27 -0
- package/dist/esm/runner/runner.js +310 -192
- package/dist/esm/sessions/base_session_service.js +1 -4
- package/dist/esm/sessions/database_session_service.js +191 -19
- package/dist/esm/sessions/db/operations.js +70 -1
- package/dist/esm/sessions/db/schema.js +4 -0
- package/dist/esm/sessions/in_memory_session_service.js +2 -2
- package/dist/esm/sessions/vertex_ai_session_service.js +11 -3
- package/dist/esm/skills/loader.js +29 -28
- package/dist/esm/telemetry/api/instrumentation.js +655 -0
- package/dist/esm/telemetry/api/internal/common/accumulators.js +139 -0
- package/dist/esm/telemetry/api/internal/common/attributes.js +94 -0
- package/dist/esm/telemetry/api/internal/common/config.js +128 -0
- package/dist/esm/telemetry/api/internal/common/error.js +69 -0
- package/dist/esm/telemetry/api/internal/common/finish_reason.js +35 -0
- package/dist/esm/telemetry/api/internal/common/genai_messages.js +188 -0
- package/dist/esm/telemetry/api/internal/common/http_exchange.js +142 -0
- package/dist/esm/telemetry/api/internal/common/provider_name.js +59 -0
- package/dist/esm/telemetry/api/internal/common/redaction.js +121 -0
- package/dist/esm/telemetry/api/internal/common/serialization.js +30 -0
- package/dist/esm/telemetry/api/internal/common/token_usage.js +85 -0
- package/dist/esm/telemetry/api/internal/logs/inference.js +23 -0
- package/dist/esm/telemetry/api/internal/logs/logger.js +19 -0
- package/dist/esm/telemetry/api/internal/logs/mcp.js +113 -0
- package/dist/esm/telemetry/api/internal/metrics/agent.js +107 -0
- package/dist/esm/telemetry/api/internal/metrics/inference_start_hook.js +29 -0
- package/dist/esm/telemetry/api/internal/metrics/meters.js +165 -0
- package/dist/esm/telemetry/api/internal/metrics/tool.js +119 -0
- package/dist/esm/telemetry/api/internal/metrics/workflow.js +112 -0
- package/dist/esm/telemetry/api/internal/trace/agent.js +25 -0
- package/dist/esm/telemetry/api/internal/trace/compaction.js +50 -0
- package/dist/esm/telemetry/api/internal/trace/inference.js +107 -0
- package/dist/esm/telemetry/api/internal/trace/live.js +28 -0
- package/dist/esm/telemetry/api/internal/trace/node.js +44 -0
- package/dist/esm/telemetry/api/internal/trace/propagation.js +39 -0
- package/dist/esm/telemetry/api/internal/trace/tool.js +96 -0
- package/dist/esm/telemetry/api/internal/trace/tracer.js +52 -0
- package/dist/esm/telemetry/api/internal/trace/workflow.js +54 -0
- package/dist/esm/telemetry/export/agent_engine.js +67 -0
- package/dist/esm/telemetry/export/agent_runtime.js +46 -0
- package/dist/esm/telemetry/export/google_cloud.js +733 -0
- package/dist/esm/telemetry/export/request_driven_metric_reader.js +276 -0
- package/dist/esm/telemetry/export/setup.js +160 -0
- package/dist/esm/tools/agent_tool.js +9 -1
- package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +23 -35
- package/dist/esm/tools/application_integration_tool/clients/connections_client.js +64 -21
- package/dist/esm/tools/application_integration_tool/clients/integration_client.js +26 -10
- package/dist/esm/tools/application_integration_tool/integration_connector_tool.js +14 -23
- package/dist/esm/tools/base_toolset.js +1 -1
- package/dist/esm/tools/computer_use/base_computer.js +99 -0
- package/dist/esm/tools/computer_use/computer_use_actions.js +477 -0
- package/dist/esm/tools/computer_use/computer_use_tool.js +217 -0
- package/dist/esm/tools/computer_use/computer_use_toolset.js +344 -0
- package/dist/esm/tools/function_tool.js +15 -5
- package/dist/esm/tools/google_api_tool/google_api_toolset.js +3 -2
- package/dist/esm/tools/google_api_tool/googleapi_to_openapi_converter.js +3 -1
- package/dist/esm/tools/load_artifacts_tool.js +15 -5
- package/dist/esm/tools/load_memory_tool.js +2 -5
- package/dist/esm/tools/mcp/mcp_session_manager.js +23 -3
- package/dist/esm/tools/mcp/mcp_tool.js +7 -3
- package/dist/esm/tools/mcp/mcp_toolset.js +18 -6
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +27 -26
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +2 -2
- package/dist/esm/tools/openapi_tool/rest_api_tool.js +45 -14
- package/dist/esm/tools/skill/load_skill_resource_tool.js +7 -0
- package/dist/esm/tools/skill/load_skill_tool.js +3 -0
- package/dist/esm/tools/skill/run_skill_script_tool.js +12 -2
- package/dist/esm/tools/toolbox_toolset.js +47 -28
- package/dist/esm/utils/async_queue.js +37 -3
- package/dist/esm/utils/client_labels.js +9 -11
- package/dist/esm/utils/env_aware_utils.js +12 -7
- package/dist/esm/utils/error_utils.js +37 -1
- package/dist/esm/utils/failover_utils.js +10 -9
- package/dist/esm/utils/gemini_schema_util.js +124 -11
- package/dist/esm/utils/id_provider.js +33 -0
- package/dist/esm/utils/model_name.js +14 -0
- package/dist/esm/utils/simple_zod_to_json.js +13 -31
- package/dist/esm/utils/ssrf_guard.js +55 -15
- package/dist/esm/version.js +1 -1
- package/dist/esm/workflow/index.js +2 -1
- package/dist/esm/workflow/node_runner.js +26 -80
- package/dist/esm/workflow/nodes/parallel_worker.js +16 -6
- package/dist/esm/workflow/run_llm_agent_as_node.js +19 -14
- package/dist/esm/workflow/utils/retry_utils.js +2 -2
- package/dist/esm/workflow/workflow.js +12 -12
- package/dist/types/a2a/a2a_remote_agent.d.ts +6 -0
- package/dist/types/a2a/a2a_remote_agent_utils.d.ts +3 -2
- package/dist/types/agents/agent_engine_client.d.ts +121 -3
- package/dist/types/agents/base_agent.d.ts +2 -0
- package/dist/types/agents/processors/content_processor_utils.d.ts +9 -9
- package/dist/types/agents/run_config.d.ts +14 -0
- package/dist/types/cli/cli_eval.d.ts +172 -9
- package/dist/types/cli/utils/cleanup.d.ts +18 -0
- package/dist/types/cli/utils/envs.d.ts +13 -3
- package/dist/types/cli/utils/evals.d.ts +64 -1
- package/dist/types/cli/utils/logs.d.ts +19 -2
- package/dist/types/cli/utils/path_validation.d.ts +30 -0
- package/dist/types/code_executors/container_code_executor.d.ts +49 -8
- package/dist/types/common.d.ts +16 -9
- package/dist/types/context/compaction_utils.d.ts +13 -1
- package/dist/types/events/event.d.ts +3 -0
- package/dist/types/features/feature_registry.d.ts +1 -0
- package/dist/types/index.d.ts +9 -6
- package/dist/types/plugins/base_plugin.d.ts +50 -21
- package/dist/types/plugins/plugin_manager.d.ts +13 -0
- package/dist/types/runner/runner.d.ts +11 -0
- package/dist/types/sessions/base_session_service.d.ts +0 -2
- package/dist/types/sessions/db/operations.d.ts +2 -1
- package/dist/types/sessions/db/schema.d.ts +5 -3
- package/dist/types/telemetry/api/instrumentation.d.ts +259 -0
- package/dist/types/telemetry/api/internal/common/accumulators.d.ts +91 -0
- package/dist/types/telemetry/api/internal/common/attributes.d.ts +90 -0
- package/dist/types/telemetry/api/internal/common/config.d.ts +61 -0
- package/dist/types/telemetry/api/internal/common/error.d.ts +29 -0
- package/dist/types/telemetry/api/internal/common/finish_reason.d.ts +18 -0
- package/dist/types/telemetry/api/internal/common/genai_messages.d.ts +26 -0
- package/dist/types/telemetry/api/internal/common/http_exchange.d.ts +50 -0
- package/dist/types/telemetry/api/internal/common/provider_name.d.ts +16 -0
- package/dist/types/telemetry/api/internal/common/redaction.d.ts +14 -0
- package/dist/types/telemetry/api/internal/common/serialization.d.ts +18 -0
- package/dist/types/telemetry/api/internal/common/token_usage.d.ts +47 -0
- package/dist/types/telemetry/api/internal/logs/inference.d.ts +15 -0
- package/dist/types/telemetry/api/internal/logs/logger.d.ts +13 -0
- package/dist/types/telemetry/api/internal/logs/mcp.d.ts +31 -0
- package/dist/types/telemetry/api/internal/metrics/agent.d.ts +28 -0
- package/dist/types/telemetry/api/internal/metrics/inference_start_hook.d.ts +12 -0
- package/dist/types/telemetry/api/internal/metrics/meters.d.ts +57 -0
- package/dist/types/telemetry/api/internal/metrics/tool.d.ts +44 -0
- package/dist/types/telemetry/api/internal/metrics/workflow.d.ts +32 -0
- package/dist/types/telemetry/api/internal/trace/agent.d.ts +14 -0
- package/dist/types/telemetry/api/internal/trace/compaction.d.ts +20 -0
- package/dist/types/telemetry/api/internal/trace/inference.d.ts +31 -0
- package/dist/types/telemetry/api/internal/trace/live.d.ts +21 -0
- package/dist/types/telemetry/api/internal/trace/node.d.ts +22 -0
- package/dist/types/telemetry/api/internal/trace/propagation.d.ts +22 -0
- package/dist/types/telemetry/api/internal/trace/tool.d.ts +57 -0
- package/dist/types/telemetry/api/internal/trace/tracer.d.ts +31 -0
- package/dist/types/telemetry/api/internal/trace/workflow.d.ts +21 -0
- package/dist/types/telemetry/export/agent_engine.d.ts +23 -0
- package/dist/types/telemetry/export/agent_runtime.d.ts +40 -0
- package/dist/types/telemetry/export/google_cloud.d.ts +189 -0
- package/dist/types/telemetry/export/request_driven_metric_reader.d.ts +144 -0
- package/dist/types/telemetry/{setup.d.ts → export/setup.d.ts} +3 -0
- package/dist/types/tools/agent_tool.d.ts +1 -1
- package/dist/types/tools/application_integration_tool/clients/connections_client.d.ts +13 -4
- package/dist/types/tools/base_toolset.d.ts +1 -1
- package/dist/types/tools/computer_use/base_computer.d.ts +281 -0
- package/dist/types/tools/computer_use/computer_use_actions.d.ts +53 -0
- package/dist/types/tools/computer_use/computer_use_tool.d.ts +108 -0
- package/dist/types/tools/computer_use/computer_use_toolset.d.ts +132 -0
- package/dist/types/tools/google_api_tool/google_api_toolset.d.ts +2 -0
- package/dist/types/tools/load_artifacts_tool.d.ts +5 -1
- package/dist/types/tools/load_memory_tool.d.ts +13 -7
- package/dist/types/tools/mcp/mcp_session_manager.d.ts +16 -0
- package/dist/types/tools/openapi_tool/auth/auth_helpers.d.ts +8 -8
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +7 -3
- package/dist/types/tools/toolbox_toolset.d.ts +15 -20
- package/dist/types/utils/async_queue.d.ts +14 -0
- package/dist/types/utils/env_aware_utils.d.ts +11 -0
- package/dist/types/utils/error_utils.d.ts +4 -0
- package/dist/types/utils/gemini_schema_util.d.ts +27 -6
- package/dist/types/utils/id_provider.d.ts +43 -0
- package/dist/types/utils/model_name.d.ts +8 -0
- package/dist/types/utils/ssrf_guard.d.ts +2 -0
- package/dist/types/version.d.ts +1 -1
- package/dist/types/workflow/index.d.ts +1 -1
- package/dist/types/workflow/nodes/parallel_worker.d.ts +8 -1
- package/dist/web/index_web.js +86 -88
- package/dist/web/index_web.js.map +4 -4
- package/package.json +13 -15
- package/dist/cjs/telemetry/google_cloud.js +0 -116
- package/dist/cjs/telemetry/tracing.js +0 -393
- package/dist/esm/telemetry/google_cloud.js +0 -99
- package/dist/esm/telemetry/setup.js +0 -88
- package/dist/esm/telemetry/tracing.js +0 -361
- package/dist/types/telemetry/google_cloud.d.ts +0 -9
- package/dist/types/telemetry/tracing.d.ts +0 -143
|
@@ -7,11 +7,11 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7
7
|
* Copyright 2026 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
*/
|
|
10
|
-
import { context, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
11
10
|
import { InvocationContext } from "../agents/invocation_context.js";
|
|
12
11
|
import { createEvent } from "../events/event.js";
|
|
13
|
-
import {
|
|
14
|
-
|
|
12
|
+
import {
|
|
13
|
+
recordNodeInvocation
|
|
14
|
+
} from "../telemetry/api/instrumentation.js";
|
|
15
15
|
import { createSubBranch } from "./branch_path.js";
|
|
16
16
|
import {
|
|
17
17
|
InvocationAbortedError,
|
|
@@ -31,11 +31,12 @@ function executeChildNode(params) {
|
|
|
31
31
|
const { parent, node, options = {} } = params;
|
|
32
32
|
const nodeName = (_a = options.nodeName) != null ? _a : node.name;
|
|
33
33
|
const nodePath = (_b = options.overrideNodePath) != null ? _b : parent.nodePath ? `${parent.nodePath}.${nodeName}` : nodeName;
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
);
|
|
34
|
+
const scope = recordNodeInvocation({
|
|
35
|
+
node,
|
|
36
|
+
nodeName,
|
|
37
|
+
sessionId: parent.invocationContext.session.id
|
|
38
|
+
});
|
|
39
|
+
return scope.run(() => runChildNode({ params, nodeName, nodePath, scope }));
|
|
39
40
|
}
|
|
40
41
|
__name(executeChildNode, "executeChildNode");
|
|
41
42
|
async function runChildNode({
|
|
@@ -50,7 +51,7 @@ async function runChildNode({
|
|
|
50
51
|
},
|
|
51
52
|
nodeName,
|
|
52
53
|
nodePath,
|
|
53
|
-
|
|
54
|
+
scope
|
|
54
55
|
}) {
|
|
55
56
|
var _a, _b, _c, _d;
|
|
56
57
|
const runId = (_a = options.runId) != null ? _a : nodeName;
|
|
@@ -104,13 +105,6 @@ async function runChildNode({
|
|
|
104
105
|
});
|
|
105
106
|
if (skipOutput !== void 0) {
|
|
106
107
|
child.output = skipOutput;
|
|
107
|
-
traceNodeExecution({
|
|
108
|
-
nodePath,
|
|
109
|
-
runId,
|
|
110
|
-
attempt: nodeState.attemptCount,
|
|
111
|
-
status: "completed",
|
|
112
|
-
interruptCount: child.interruptIds.length
|
|
113
|
-
});
|
|
114
108
|
if (options.useAsOutput) {
|
|
115
109
|
parent.output = child.output;
|
|
116
110
|
parent.route = child.route;
|
|
@@ -124,16 +118,14 @@ async function runChildNode({
|
|
|
124
118
|
resetState(child);
|
|
125
119
|
child.attemptCount = nodeState.attemptCount;
|
|
126
120
|
try {
|
|
127
|
-
inputRecorded = await
|
|
121
|
+
inputRecorded = await runOnce({
|
|
128
122
|
node,
|
|
129
123
|
child,
|
|
130
124
|
input,
|
|
131
125
|
nodeName,
|
|
132
126
|
branch,
|
|
133
127
|
isolationScope,
|
|
134
|
-
|
|
135
|
-
runId,
|
|
136
|
-
attempt: nodeState.attemptCount
|
|
128
|
+
scope
|
|
137
129
|
});
|
|
138
130
|
failIfNodeReportedError(child, nodeName);
|
|
139
131
|
succeeded = true;
|
|
@@ -160,13 +152,6 @@ async function runChildNode({
|
|
|
160
152
|
if (!inputRecorded && child.interruptIds.length > 0) {
|
|
161
153
|
recordInputForResume({ child, nodeName, branch, isolationScope, input });
|
|
162
154
|
}
|
|
163
|
-
traceNodeExecution({
|
|
164
|
-
nodePath,
|
|
165
|
-
runId,
|
|
166
|
-
attempt: nodeState.attemptCount,
|
|
167
|
-
status: child.interruptIds.length > 0 ? "waiting" : "completed",
|
|
168
|
-
interruptCount: child.interruptIds.length
|
|
169
|
-
});
|
|
170
155
|
if (pluginManager == null ? void 0 : pluginManager.hasPlugins) {
|
|
171
156
|
const replacedOutput = await pluginManager.runAfterNodeCallback({
|
|
172
157
|
node,
|
|
@@ -184,58 +169,13 @@ async function runChildNode({
|
|
|
184
169
|
}
|
|
185
170
|
return child;
|
|
186
171
|
} catch (err) {
|
|
187
|
-
|
|
188
|
-
nodePath,
|
|
189
|
-
runId,
|
|
190
|
-
attempt: nodeState.attemptCount,
|
|
191
|
-
status: "failed",
|
|
192
|
-
interruptCount: child.interruptIds.length
|
|
193
|
-
});
|
|
194
|
-
span.setStatus({ code: SpanStatusCode.ERROR, message: formatError(err) });
|
|
172
|
+
scope.end(err);
|
|
195
173
|
throw err;
|
|
196
174
|
} finally {
|
|
197
|
-
|
|
175
|
+
scope.end();
|
|
198
176
|
}
|
|
199
177
|
}
|
|
200
178
|
__name(runChildNode, "runChildNode");
|
|
201
|
-
function runAttempt(params) {
|
|
202
|
-
const { node, nodePath, runId, attempt } = params;
|
|
203
|
-
if (!node.preparedRetryConfig) {
|
|
204
|
-
return runOnce(params);
|
|
205
|
-
}
|
|
206
|
-
return tracer.startActiveSpan(
|
|
207
|
-
`execute_node_attempt ${params.nodeName}`,
|
|
208
|
-
async (span) => {
|
|
209
|
-
try {
|
|
210
|
-
const inputRecorded = await runOnce(params);
|
|
211
|
-
traceNodeExecution({
|
|
212
|
-
nodePath,
|
|
213
|
-
runId,
|
|
214
|
-
attempt,
|
|
215
|
-
status: params.child.interruptIds.length > 0 ? "waiting" : "completed",
|
|
216
|
-
interruptCount: params.child.interruptIds.length
|
|
217
|
-
});
|
|
218
|
-
return inputRecorded;
|
|
219
|
-
} catch (err) {
|
|
220
|
-
traceNodeExecution({
|
|
221
|
-
nodePath,
|
|
222
|
-
runId,
|
|
223
|
-
attempt,
|
|
224
|
-
status: "failed",
|
|
225
|
-
interruptCount: params.child.interruptIds.length
|
|
226
|
-
});
|
|
227
|
-
span.setStatus({
|
|
228
|
-
code: SpanStatusCode.ERROR,
|
|
229
|
-
message: formatError(err)
|
|
230
|
-
});
|
|
231
|
-
throw err;
|
|
232
|
-
} finally {
|
|
233
|
-
span.end();
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
__name(runAttempt, "runAttempt");
|
|
239
179
|
function failIfNodeReportedError(child, nodeName) {
|
|
240
180
|
const reported = child.reportedError;
|
|
241
181
|
if (!reported || child.output !== void 0 || child.route !== void 0 || child.interruptIds.length > 0) {
|
|
@@ -262,11 +202,12 @@ async function runOnce({
|
|
|
262
202
|
input,
|
|
263
203
|
nodeName,
|
|
264
204
|
branch,
|
|
265
|
-
isolationScope
|
|
205
|
+
isolationScope,
|
|
206
|
+
scope
|
|
266
207
|
}) {
|
|
267
208
|
var _a;
|
|
268
209
|
let inputRecorded = false;
|
|
269
|
-
const consume = /* @__PURE__ */ __name((event) => {
|
|
210
|
+
const consume = /* @__PURE__ */ __name(async (event) => {
|
|
270
211
|
var _a2, _b, _c;
|
|
271
212
|
enrichEvent({ event, child, nodeName, branch, isolationScope });
|
|
272
213
|
const emittedDelta = (_a2 = event.actions) == null ? void 0 : _a2.stateDelta;
|
|
@@ -305,13 +246,18 @@ async function runOnce({
|
|
|
305
246
|
};
|
|
306
247
|
inputRecorded = true;
|
|
307
248
|
}
|
|
308
|
-
|
|
249
|
+
scope.recordEvent(event);
|
|
250
|
+
if (event.partial) {
|
|
251
|
+
child.channel.push(event);
|
|
252
|
+
} else {
|
|
253
|
+
await child.channel.pushAndWait(event);
|
|
254
|
+
}
|
|
309
255
|
}, "consume");
|
|
310
256
|
const parentSignal = child.invocationContext.abortSignal;
|
|
311
257
|
const hasTimeout = typeof node.timeout === "number" && node.timeout > 0;
|
|
312
258
|
if (!hasTimeout && !parentSignal) {
|
|
313
259
|
for await (const event of node.run(child, input)) {
|
|
314
|
-
consume(event);
|
|
260
|
+
await consume(event);
|
|
315
261
|
}
|
|
316
262
|
return inputRecorded;
|
|
317
263
|
}
|
|
@@ -319,7 +265,7 @@ async function runOnce({
|
|
|
319
265
|
child.abortSignal = parentSignal;
|
|
320
266
|
try {
|
|
321
267
|
for await (const event of node.run(child, input)) {
|
|
322
|
-
consume(event);
|
|
268
|
+
await consume(event);
|
|
323
269
|
}
|
|
324
270
|
} finally {
|
|
325
271
|
child.abortSignal = void 0;
|
|
@@ -359,7 +305,7 @@ async function runOnce({
|
|
|
359
305
|
try {
|
|
360
306
|
let result = await Promise.race([iterator.next(), aborted]);
|
|
361
307
|
while (!result.done) {
|
|
362
|
-
consume(result.value);
|
|
308
|
+
await Promise.race([consume(result.value), aborted]);
|
|
363
309
|
result = await Promise.race([iterator.next(), aborted]);
|
|
364
310
|
}
|
|
365
311
|
} finally {
|
|
@@ -7,14 +7,19 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
|
|
|
7
7
|
* Copyright 2026 Google LLC
|
|
8
8
|
* SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
*/
|
|
10
|
+
var _a, _b;
|
|
10
11
|
import { BaseNode } from "../base_node.js";
|
|
11
12
|
import { isNodeInterruptedError } from "../errors.js";
|
|
12
13
|
import { buildNode } from "../utils/workflow_graph_utils.js";
|
|
13
14
|
const DEFAULT_MAX_PARALLEL_WORKERS = 8;
|
|
14
|
-
const
|
|
15
|
+
const PARALLEL_WORKER_SIGNATURE_SYMBOL = /* @__PURE__ */ Symbol.for(
|
|
16
|
+
"google.adk.workflow.parallelWorker"
|
|
17
|
+
);
|
|
18
|
+
const _ParallelWorker = class _ParallelWorker extends (_b = BaseNode, _a = PARALLEL_WORKER_SIGNATURE_SYMBOL, _b) {
|
|
15
19
|
constructor(inner, config = {}) {
|
|
16
20
|
const built = buildNode(inner);
|
|
17
21
|
super({ name: built.name, rerunOnResume: true });
|
|
22
|
+
this[_a] = true;
|
|
18
23
|
if (config.maxParallelWorkers !== void 0 && config.maxParallelWorkers < 1) {
|
|
19
24
|
throw new Error("maxParallelWorkers must be greater than or equal to 1.");
|
|
20
25
|
}
|
|
@@ -22,7 +27,7 @@ const _ParallelWorker = class _ParallelWorker extends BaseNode {
|
|
|
22
27
|
this.maxParallelWorkers = config.maxParallelWorkers;
|
|
23
28
|
}
|
|
24
29
|
async *runImpl(ctx, input) {
|
|
25
|
-
var
|
|
30
|
+
var _a2;
|
|
26
31
|
const items = Array.isArray(input) ? input : [input];
|
|
27
32
|
if (items.length === 0) {
|
|
28
33
|
yield [];
|
|
@@ -30,7 +35,7 @@ const _ParallelWorker = class _ParallelWorker extends BaseNode {
|
|
|
30
35
|
}
|
|
31
36
|
const results = new Array(items.length);
|
|
32
37
|
const poolSize = Math.min(
|
|
33
|
-
(
|
|
38
|
+
(_a2 = this.maxParallelWorkers) != null ? _a2 : DEFAULT_MAX_PARALLEL_WORKERS,
|
|
34
39
|
items.length
|
|
35
40
|
);
|
|
36
41
|
let nextIndex = 0;
|
|
@@ -39,8 +44,8 @@ const _ParallelWorker = class _ParallelWorker extends BaseNode {
|
|
|
39
44
|
let interrupted = false;
|
|
40
45
|
const interruptIds = [];
|
|
41
46
|
const isAborted = /* @__PURE__ */ __name(() => {
|
|
42
|
-
var
|
|
43
|
-
return ((
|
|
47
|
+
var _a3, _b2;
|
|
48
|
+
return ((_a3 = ctx.abortSignal) == null ? void 0 : _a3.aborted) === true || ((_b2 = ctx.invocationContext.abortSignal) == null ? void 0 : _b2.aborted) === true;
|
|
44
49
|
}, "isAborted");
|
|
45
50
|
const worker = /* @__PURE__ */ __name(async () => {
|
|
46
51
|
while (!failed && !interrupted && !isAborted()) {
|
|
@@ -97,6 +102,11 @@ const _ParallelWorker = class _ParallelWorker extends BaseNode {
|
|
|
97
102
|
};
|
|
98
103
|
__name(_ParallelWorker, "ParallelWorker");
|
|
99
104
|
let ParallelWorker = _ParallelWorker;
|
|
105
|
+
function isParallelWorker(value) {
|
|
106
|
+
return typeof value === "object" && value !== null && PARALLEL_WORKER_SIGNATURE_SYMBOL in value && value[PARALLEL_WORKER_SIGNATURE_SYMBOL] === true;
|
|
107
|
+
}
|
|
108
|
+
__name(isParallelWorker, "isParallelWorker");
|
|
100
109
|
export {
|
|
101
|
-
ParallelWorker
|
|
110
|
+
ParallelWorker,
|
|
111
|
+
isParallelWorker
|
|
102
112
|
};
|
|
@@ -23,9 +23,7 @@ async function* runLlmAgentAsNode(agent, ctx, nodeInput) {
|
|
|
23
23
|
if (!isTaskMode && !agent.includeContentsExplicit) {
|
|
24
24
|
agent.includeContents = "none";
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
await appendNodeInputAsUserTurn(ctx, nodeInput);
|
|
28
|
-
}
|
|
26
|
+
const inputEvent = isTaskMode ? void 0 : pushNodeInputAsUserTurn(ctx, nodeInput);
|
|
29
27
|
const agentIc = withWorkflowInstructionScope(ctx.getInvocationContext(), {
|
|
30
28
|
input: nodeInput,
|
|
31
29
|
outputsByNode: collectPredecessorOutputs(ctx)
|
|
@@ -34,15 +32,19 @@ async function* runLlmAgentAsNode(agent, ctx, nodeInput) {
|
|
|
34
32
|
yield* runTaskMode(ctx, agentIc, agent);
|
|
35
33
|
return;
|
|
36
34
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
try {
|
|
36
|
+
for await (const event of agent.runAsync(agentIc)) {
|
|
37
|
+
maybeSetOutput(agent, event);
|
|
38
|
+
yield event;
|
|
39
|
+
}
|
|
40
|
+
} finally {
|
|
41
|
+
removeEvent(ctx.session.events, inputEvent);
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
__name(runLlmAgentAsNode, "runLlmAgentAsNode");
|
|
43
|
-
|
|
45
|
+
function pushNodeInputAsUserTurn(ctx, nodeInput) {
|
|
44
46
|
if (nodeInput === void 0 || nodeInput === null) {
|
|
45
|
-
return;
|
|
47
|
+
return void 0;
|
|
46
48
|
}
|
|
47
49
|
const userEvent = createEvent({
|
|
48
50
|
author: "user",
|
|
@@ -53,14 +55,17 @@ async function appendNodeInputAsUserTurn(ctx, nodeInput) {
|
|
|
53
55
|
if (ctx.isolationScope !== void 0) {
|
|
54
56
|
userEvent.isolationScope = ctx.isolationScope;
|
|
55
57
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
ctx.session.events.push(userEvent);
|
|
59
|
+
return userEvent;
|
|
60
|
+
}
|
|
61
|
+
__name(pushNodeInputAsUserTurn, "pushNodeInputAsUserTurn");
|
|
62
|
+
function removeEvent(events, event) {
|
|
63
|
+
const index = event ? events.indexOf(event) : -1;
|
|
64
|
+
if (index !== -1) {
|
|
65
|
+
events.splice(index, 1);
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
|
-
__name(
|
|
68
|
+
__name(removeEvent, "removeEvent");
|
|
64
69
|
async function* runTaskMode(ctx, agentIc, agent) {
|
|
65
70
|
var _a, _b;
|
|
66
71
|
const finishTool = agent.finishTaskTool;
|
|
@@ -13,7 +13,7 @@ const DEFAULT_MAX_DELAY_SECONDS = 60;
|
|
|
13
13
|
const DEFAULT_BACKOFF_FACTOR = 2;
|
|
14
14
|
const DEFAULT_JITTER = 1;
|
|
15
15
|
function errorNames(error) {
|
|
16
|
-
var _a;
|
|
16
|
+
var _a, _b, _c;
|
|
17
17
|
if (error instanceof Error) {
|
|
18
18
|
const names = [(_a = error.constructor) == null ? void 0 : _a.name, error.name].filter(
|
|
19
19
|
(name) => !!name
|
|
@@ -21,7 +21,7 @@ function errorNames(error) {
|
|
|
21
21
|
return [...new Set(names)];
|
|
22
22
|
}
|
|
23
23
|
if (typeof error === "object" && error !== null) {
|
|
24
|
-
return [error.constructor.name];
|
|
24
|
+
return [(_c = (_b = error.constructor) == null ? void 0 : _b.name) != null ? _c : "Object"];
|
|
25
25
|
}
|
|
26
26
|
return [typeof error];
|
|
27
27
|
}
|
|
@@ -17,8 +17,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
17
17
|
* SPDX-License-Identifier: Apache-2.0
|
|
18
18
|
*/
|
|
19
19
|
var _a, _b;
|
|
20
|
-
import {
|
|
21
|
-
import { tracer, traceWorkflowInvocation } from "../telemetry/tracing.js";
|
|
20
|
+
import { recordWorkflowInvocation } from "../telemetry/api/instrumentation.js";
|
|
22
21
|
import { experimental } from "../utils/experimental.js";
|
|
23
22
|
import { BaseNode } from "./base_node.js";
|
|
24
23
|
import { commonPrefixOf } from "./branch_path.js";
|
|
@@ -96,19 +95,20 @@ let Workflow = class extends (_b = BaseNode, _a = WORKFLOW_SIGNATURE_SYMBOL, _b)
|
|
|
96
95
|
dynamicState,
|
|
97
96
|
abort.controller.signal
|
|
98
97
|
);
|
|
99
|
-
const
|
|
98
|
+
const telemetryScope = recordWorkflowInvocation({
|
|
99
|
+
workflow: this,
|
|
100
|
+
sessionId: ctx.invocationContext.session.id
|
|
101
|
+
});
|
|
100
102
|
try {
|
|
101
|
-
await
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return this.orchestrate(ctx, nodeInput, dynamicState, abort.controller);
|
|
108
|
-
});
|
|
103
|
+
await telemetryScope.run(
|
|
104
|
+
() => this.orchestrate(ctx, nodeInput, dynamicState, abort.controller)
|
|
105
|
+
);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
telemetryScope.end(error);
|
|
108
|
+
throw error;
|
|
109
109
|
} finally {
|
|
110
110
|
abort.dispose();
|
|
111
|
-
|
|
111
|
+
telemetryScope.end();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
@@ -56,10 +56,16 @@ export interface RemoteA2AAgentConfig extends BaseAgentConfig {
|
|
|
56
56
|
resolveAgentCardOptions?: ResolveAgentCardOptions;
|
|
57
57
|
/**
|
|
58
58
|
* Optional pre-initialized Client for connection pooling.
|
|
59
|
+
*
|
|
60
|
+
* A provided client sends requests as it is configured, so the default
|
|
61
|
+
* trace context propagation does not apply to it.
|
|
59
62
|
*/
|
|
60
63
|
client?: Client;
|
|
61
64
|
/**
|
|
62
65
|
* Optional ClientFactory for creating the A2A Client.
|
|
66
|
+
*
|
|
67
|
+
* Clients from a provided factory send requests as it is configured, so the
|
|
68
|
+
* default trace context propagation does not apply to them.
|
|
63
69
|
*/
|
|
64
70
|
clientFactory?: ClientFactory;
|
|
65
71
|
/**
|
|
@@ -15,14 +15,15 @@ export interface UserFunctionCall {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Returns a UserFunctionCall when the event at `index` contains a
|
|
18
|
-
* FunctionResponse that can be traced back to
|
|
18
|
+
* FunctionResponse that can be traced back to this agent's FunctionCall event.
|
|
19
19
|
*
|
|
20
20
|
* @param session - The session whose event history to inspect.
|
|
21
21
|
* @param index - Index of the candidate event to examine.
|
|
22
|
+
* @param agentName - The remote agent whose pending task to resume.
|
|
22
23
|
* @returns The matching `UserFunctionCall`, or `undefined` if the event at
|
|
23
24
|
* `index` is not a user function-response event or has no preceding call.
|
|
24
25
|
*/
|
|
25
|
-
export declare function getUserFunctionCallAt(session: Session, index: number): UserFunctionCall | undefined;
|
|
26
|
+
export declare function getUserFunctionCallAt(session: Session, index: number, agentName: string): UserFunctionCall | undefined;
|
|
26
27
|
/**
|
|
27
28
|
* Checks if an event contains a function call with the given ID.
|
|
28
29
|
*
|
|
@@ -3,35 +3,153 @@
|
|
|
3
3
|
* Copyright 2026 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
+
/** Identifies the deployed Agent Engine that an {@link AgentEngineClient} calls. */
|
|
6
7
|
export interface AgentEngineConfig {
|
|
7
8
|
project: string;
|
|
8
9
|
location: string;
|
|
9
10
|
reasoningEngineId: string;
|
|
11
|
+
/**
|
|
12
|
+
* Overrides the API endpoint. By default the endpoint is resolved from
|
|
13
|
+
* `location`, and `global` resolves to `aiplatform.googleapis.com`.
|
|
14
|
+
*/
|
|
15
|
+
apiEndpoint?: string;
|
|
10
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Arguments for a session operation on a deployed Agent Engine.
|
|
19
|
+
*
|
|
20
|
+
* The client sends `userId`, `sessionId` and `expireTime` as `user_id`,
|
|
21
|
+
* `session_id` and `expire_time`, which are the argument names the remote
|
|
22
|
+
* methods read. When both spellings are given, the snake_case value wins.
|
|
23
|
+
* Other keys are sent unchanged.
|
|
24
|
+
*/
|
|
11
25
|
export interface SessionConfig {
|
|
12
26
|
userId?: string;
|
|
27
|
+
user_id?: string;
|
|
13
28
|
sessionId?: string;
|
|
29
|
+
session_id?: string;
|
|
30
|
+
state?: Record<string, unknown>;
|
|
31
|
+
ttl?: string;
|
|
32
|
+
expireTime?: string;
|
|
33
|
+
expire_time?: string;
|
|
34
|
+
appName?: string;
|
|
35
|
+
app_name?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Overrides the remote class method that the client calls. The client sends
|
|
38
|
+
* it on the request itself, never inside `input`.
|
|
39
|
+
*/
|
|
40
|
+
classMethod?: string;
|
|
41
|
+
[key: string]: unknown;
|
|
14
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Arguments for {@link AgentEngineClient.query} and
|
|
45
|
+
* {@link AgentEngineClient.streamQuery}.
|
|
46
|
+
*
|
|
47
|
+
* The client sends `runConfig` and `stateDelta` as `run_config` and
|
|
48
|
+
* `state_delta`, in addition to the renames that {@link SessionConfig}
|
|
49
|
+
* describes.
|
|
50
|
+
*/
|
|
15
51
|
export interface QueryConfig extends SessionConfig {
|
|
16
52
|
message: unknown;
|
|
53
|
+
/**
|
|
54
|
+
* The run configuration for the remote agent. The client renames only this
|
|
55
|
+
* top-level key and sends the contents unchanged. Use the field names that
|
|
56
|
+
* the remote engine expects, for example `max_llm_calls` for a Python
|
|
57
|
+
* engine.
|
|
58
|
+
*/
|
|
59
|
+
runConfig?: Record<string, unknown>;
|
|
60
|
+
/** The same as {@link QueryConfig.runConfig}. When both are given, this wins. */
|
|
61
|
+
run_config?: Record<string, unknown>;
|
|
17
62
|
[key: string]: unknown;
|
|
18
63
|
}
|
|
64
|
+
/** Arguments for {@link AgentEngineClient.getSession}. */
|
|
65
|
+
export type GetSessionConfig = SessionConfig;
|
|
66
|
+
/** Arguments for {@link AgentEngineClient.listSessions}. */
|
|
67
|
+
export type ListSessionsConfig = SessionConfig;
|
|
68
|
+
/** Arguments for {@link AgentEngineClient.deleteSession}. */
|
|
69
|
+
export type DeleteSessionConfig = SessionConfig;
|
|
70
|
+
/** Thrown when a call to a deployed Agent Engine fails. */
|
|
19
71
|
export declare class AgentExecutionError extends Error {
|
|
20
72
|
readonly cause?: unknown | undefined;
|
|
21
73
|
constructor(message: string, cause?: unknown | undefined);
|
|
22
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Calls an agent deployed to Vertex AI Agent Engine.
|
|
77
|
+
*
|
|
78
|
+
* The client loads the optional peer dependency `@google-cloud/aiplatform` on
|
|
79
|
+
* its first call, not when it is constructed. Call
|
|
80
|
+
* {@link AgentEngineClient.close} to release
|
|
81
|
+
* the underlying gRPC channel.
|
|
82
|
+
*/
|
|
23
83
|
export declare class AgentEngineClient {
|
|
24
|
-
private
|
|
25
|
-
private reasoningEnginePath;
|
|
84
|
+
private readonly apiEndpoint;
|
|
85
|
+
private readonly reasoningEnginePath;
|
|
86
|
+
private clientPromise?;
|
|
26
87
|
constructor(config: AgentEngineConfig);
|
|
27
88
|
/**
|
|
28
89
|
* Creates a remote session.
|
|
29
90
|
*
|
|
30
|
-
*
|
|
91
|
+
* Calls the `async_create_session` class method unless `config.classMethod`
|
|
92
|
+
* names another one.
|
|
93
|
+
*
|
|
94
|
+
* @returns The session payload returned by the Agent Engine. When
|
|
31
95
|
* `config.sessionId` is omitted the engine generates one, and this is the
|
|
32
96
|
* only place the caller can read it back from.
|
|
33
97
|
*/
|
|
34
98
|
createSession(config: SessionConfig): Promise<unknown>;
|
|
99
|
+
/**
|
|
100
|
+
* Reads a remote session.
|
|
101
|
+
*
|
|
102
|
+
* Calls the `async_get_session` class method unless `config.classMethod`
|
|
103
|
+
* names another one.
|
|
104
|
+
*
|
|
105
|
+
* @throws {@link AgentExecutionError} if the user id or the session id is
|
|
106
|
+
* missing, or if the call fails.
|
|
107
|
+
*/
|
|
108
|
+
getSession(config: GetSessionConfig): Promise<unknown>;
|
|
109
|
+
/**
|
|
110
|
+
* Lists the remote sessions of a user.
|
|
111
|
+
*
|
|
112
|
+
* Calls the `async_list_sessions` class method unless `config.classMethod`
|
|
113
|
+
* names another one.
|
|
114
|
+
*/
|
|
115
|
+
listSessions(config: ListSessionsConfig): Promise<unknown>;
|
|
116
|
+
/**
|
|
117
|
+
* Deletes a remote session.
|
|
118
|
+
*
|
|
119
|
+
* Calls the `async_delete_session` class method unless `config.classMethod`
|
|
120
|
+
* names another one.
|
|
121
|
+
*/
|
|
122
|
+
deleteSession(config: DeleteSessionConfig): Promise<void>;
|
|
123
|
+
/**
|
|
124
|
+
* Sends a query and waits for the whole response.
|
|
125
|
+
*
|
|
126
|
+
* Calls the `query` class method unless `config.classMethod` names another
|
|
127
|
+
* one.
|
|
128
|
+
*/
|
|
35
129
|
query(config: QueryConfig): Promise<unknown>;
|
|
130
|
+
/**
|
|
131
|
+
* Sends a query and yields each streamed response value.
|
|
132
|
+
*
|
|
133
|
+
* Calls the `async_stream_query` class method unless `config.classMethod`
|
|
134
|
+
* names another one. The stream can be server-sent events or
|
|
135
|
+
* newline-delimited JSON.
|
|
136
|
+
*/
|
|
36
137
|
streamQuery(config: QueryConfig): AsyncGenerator<unknown, void, unknown>;
|
|
138
|
+
/**
|
|
139
|
+
* Closes the underlying gRPC client.
|
|
140
|
+
*
|
|
141
|
+
* Does nothing if no call has created the client yet, and is safe to call
|
|
142
|
+
* more than once. A later call creates a new client.
|
|
143
|
+
*/
|
|
144
|
+
close(): Promise<void>;
|
|
145
|
+
private callQueryMethod;
|
|
146
|
+
/**
|
|
147
|
+
* Resolves the SDK helpers and the gRPC client, loading the optional peer on
|
|
148
|
+
* first use.
|
|
149
|
+
*
|
|
150
|
+
* A created client is kept. A failure is not kept, so the next call tries
|
|
151
|
+
* again, for example once the peer is installed.
|
|
152
|
+
*/
|
|
153
|
+
private getClient;
|
|
154
|
+
private createClient;
|
|
37
155
|
}
|
|
@@ -187,6 +187,8 @@ export declare abstract class BaseAgent<TConfig extends BaseAgentConfig = BaseAg
|
|
|
187
187
|
* @returns An AsyncGenerator that yields the events generated by the agent.
|
|
188
188
|
*/
|
|
189
189
|
runLive(parentContext: InvocationContext): AsyncGenerator<Event, void, void>;
|
|
190
|
+
/** Reports execution failures without replacing the original thrown value. */
|
|
191
|
+
private handleAgentErrorCallback;
|
|
190
192
|
/**
|
|
191
193
|
* Core logic to run this agent via text-based conversation.
|
|
192
194
|
*
|
|
@@ -16,11 +16,11 @@ export declare function removeClientFunctionCallId(content: Content): void;
|
|
|
16
16
|
/**
|
|
17
17
|
* Get the contents for the LLM request.
|
|
18
18
|
*
|
|
19
|
-
* @param events
|
|
20
|
-
* @param agentName
|
|
21
|
-
* @param currentBranch
|
|
22
|
-
* @param currentIsolationScope
|
|
23
|
-
* @param preserveFunctionCallIds
|
|
19
|
+
* @param events A list of all session events.
|
|
20
|
+
* @param agentName The name of the agent.
|
|
21
|
+
* @param currentBranch The current branch of the agent.
|
|
22
|
+
* @param currentIsolationScope The isolation scope of the current node, if any.
|
|
23
|
+
* @param preserveFunctionCallIds Whether to preserve client-generated
|
|
24
24
|
* `adk-*` function call and response IDs instead of stripping them.
|
|
25
25
|
*
|
|
26
26
|
* @returns A list of processed contents.
|
|
@@ -37,9 +37,9 @@ export declare function getContents(events: Event[], agentName: string, currentB
|
|
|
37
37
|
* In multi-agent scenarios, the "current turn" for an agent starts from an
|
|
38
38
|
* actual user or from another agent.
|
|
39
39
|
*
|
|
40
|
-
* @param events
|
|
41
|
-
* @param agentName
|
|
42
|
-
* @param currentBranch
|
|
40
|
+
* @param events A list of all session events.
|
|
41
|
+
* @param agentName The name of the agent.
|
|
42
|
+
* @param currentBranch The current branch of the agent.
|
|
43
43
|
*
|
|
44
44
|
* @returns A list of contents for the current turn only, preserving context
|
|
45
45
|
* needed for proper tool execution while excluding conversation history.
|
|
@@ -52,7 +52,7 @@ export declare function getCurrentTurnContents(events: Event[], agentName: strin
|
|
|
52
52
|
* 1. function_call and function_response are always of the same number.
|
|
53
53
|
* 2. The function_call and function_response are consecutively in the content.
|
|
54
54
|
*
|
|
55
|
-
* @param events
|
|
55
|
+
* @param events A list of function_response events.
|
|
56
56
|
*
|
|
57
57
|
* NOTE:
|
|
58
58
|
* function_response_events must fulfill these requirements:
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { AudioTranscriptionConfig, ContextWindowCompressionConfig, Modality, ProactivityConfig, RealtimeInputConfig, SpeechConfig } from '@google/genai';
|
|
7
|
+
import type { TelemetryConfig } from '../telemetry/api/instrumentation.js';
|
|
7
8
|
/**
|
|
8
9
|
* The streaming mode for the run config.
|
|
9
10
|
*/
|
|
@@ -123,6 +124,18 @@ export interface RunConfig {
|
|
|
123
124
|
* option does not exist there.
|
|
124
125
|
*/
|
|
125
126
|
allowRemoteToolConfirmation?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Telemetry overrides for this run.
|
|
129
|
+
*
|
|
130
|
+
* Each field set here replaces its environment variable for the spans, log
|
|
131
|
+
* records and metrics of this run only; a field left unset falls back to the
|
|
132
|
+
* environment. An operator can make the environment win over every run by
|
|
133
|
+
* setting `ADK_TELEMETRY_IGNORE_RUN_CONFIG` to `true` or `1`.
|
|
134
|
+
*
|
|
135
|
+
* WARNING: This feature is **experimental** and its API or behavior may
|
|
136
|
+
* change in future releases.
|
|
137
|
+
*/
|
|
138
|
+
telemetry?: TelemetryConfig;
|
|
126
139
|
/**
|
|
127
140
|
* Set by the A2A executor to record that this run's message came from a
|
|
128
141
|
* remote peer. Not part of the configuration surface: an application setting
|
|
@@ -173,5 +186,6 @@ export declare function createRunConfig(params?: Partial<RunConfig>): {
|
|
|
173
186
|
plainTextToolConfirmation?: boolean | undefined;
|
|
174
187
|
a2aMetadata?: Record<string, unknown> | undefined;
|
|
175
188
|
allowRemoteToolConfirmation?: boolean | undefined;
|
|
189
|
+
telemetry?: TelemetryConfig | undefined;
|
|
176
190
|
remoteDelivered?: boolean | undefined;
|
|
177
191
|
};
|