@google/adk 2.3.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 +399 -0
- package/dist/cjs/agents/base_agent.js +127 -68
- package/dist/cjs/agents/functions.js +64 -59
- package/dist/cjs/agents/instructions.js +8 -6
- package/dist/cjs/agents/invocation_context.js +2 -2
- package/dist/cjs/agents/llm_agent.js +124 -101
- 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 +72 -17
- package/dist/cjs/agents/processors/content_request_processor.js +51 -2
- 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 +13 -3
- 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 +134 -15
- package/dist/cjs/cli/utils/path_validation.js +83 -0
- package/dist/cjs/code_executors/container_code_executor.js +171 -38
- package/dist/cjs/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/cjs/common.js +59 -32
- package/dist/cjs/context/compaction_utils.js +19 -0
- package/dist/cjs/errors/input_validation_error.js +3 -2
- package/dist/cjs/events/event.js +7 -3
- package/dist/cjs/features/feature_registry.js +5 -0
- package/dist/cjs/index.js +34 -12
- 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 +54 -40
- 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 +15 -12
- package/dist/cjs/sessions/database_session_service.js +232 -38
- 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/stale_session_error.js +59 -0
- package/dist/cjs/sessions/vertex_ai_session_service.js +11 -3
- package/dist/cjs/skills/loader.js +76 -41
- 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 -6
- package/dist/cjs/tools/agent_tool.js +9 -1
- package/dist/cjs/tools/apihub_tool/apihub_toolset.js +18 -23
- package/dist/cjs/tools/application_integration_tool/application_integration_toolset.js +109 -43
- package/dist/cjs/tools/application_integration_tool/clients/connections_client.js +222 -114
- package/dist/cjs/tools/application_integration_tool/clients/integration_client.js +34 -14
- package/dist/cjs/tools/application_integration_tool/integration_connector_tool.js +175 -0
- 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_tool.js +4 -1
- package/dist/cjs/tools/google_api_tool/google_api_toolset.js +174 -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 +5 -3
- package/dist/cjs/tools/google_api_tool/index.js +20 -23
- package/dist/cjs/tools/load_artifacts_tool.js +27 -11
- package/dist/cjs/tools/load_memory_tool.js +14 -15
- 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 +19 -20
- package/dist/cjs/tools/openapi_tool/auth/auth_helpers.js +30 -29
- package/dist/cjs/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +4 -4
- 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 +57 -10
- 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 +193 -0
- package/dist/cjs/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/cjs/utils/async_queue.js +37 -3
- package/dist/cjs/utils/client_labels.js +17 -2
- 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 +11 -10
- package/dist/cjs/utils/gemini_schema_util.js +145 -14
- package/dist/cjs/utils/id_provider.js +63 -0
- package/dist/cjs/utils/logger_node.js +4 -0
- package/dist/cjs/utils/model_name.js +15 -0
- package/dist/cjs/utils/output_schema_utils.js +5 -2
- package/dist/cjs/utils/simple_zod_to_json.js +13 -31
- package/dist/cjs/utils/ssrf_guard.js +46 -16
- package/dist/cjs/utils/task.js +1 -1
- 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 +382 -0
- package/dist/esm/agents/base_agent.js +127 -72
- package/dist/esm/agents/functions.js +69 -63
- package/dist/esm/agents/instructions.js +8 -6
- package/dist/esm/agents/invocation_context.js +2 -2
- package/dist/esm/agents/llm_agent.js +130 -106
- 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 +72 -17
- package/dist/esm/agents/processors/content_request_processor.js +51 -2
- 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 +13 -3
- 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 +132 -13
- package/dist/esm/cli/utils/path_validation.js +45 -0
- package/dist/esm/code_executors/container_code_executor.js +171 -38
- package/dist/esm/code_executors/unsafe_local_code_executor.js +6 -1
- package/dist/esm/common.js +59 -19
- package/dist/esm/context/compaction_utils.js +19 -0
- package/dist/esm/errors/input_validation_error.js +3 -2
- package/dist/esm/events/event.js +7 -3
- package/dist/esm/features/feature_registry.js +5 -0
- package/dist/esm/index.js +36 -10
- 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 +54 -40
- 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 +13 -11
- package/dist/esm/sessions/database_session_service.js +231 -38
- 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/stale_session_error.js +31 -0
- package/dist/esm/sessions/vertex_ai_session_service.js +11 -3
- package/dist/esm/skills/loader.js +76 -41
- 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/apihub_tool/apihub_toolset.js +17 -22
- package/dist/esm/tools/application_integration_tool/application_integration_toolset.js +114 -44
- package/dist/esm/tools/application_integration_tool/clients/connections_client.js +226 -115
- package/dist/esm/tools/application_integration_tool/clients/integration_client.js +34 -14
- package/dist/esm/tools/application_integration_tool/integration_connector_tool.js +149 -0
- 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_tool.js +4 -1
- package/dist/esm/tools/google_api_tool/google_api_toolset.js +147 -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 +5 -3
- package/dist/esm/tools/google_api_tool/index.js +18 -20
- package/dist/esm/tools/load_artifacts_tool.js +25 -10
- package/dist/esm/tools/load_memory_tool.js +14 -15
- 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 +19 -20
- package/dist/esm/tools/openapi_tool/auth/auth_helpers.js +27 -26
- package/dist/esm/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.js +4 -4
- 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 +57 -10
- 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 +167 -0
- package/dist/esm/tools/webmcp/webmcp_toolset.js +1 -14
- package/dist/esm/utils/async_queue.js +37 -3
- package/dist/esm/utils/client_labels.js +17 -2
- 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 +11 -10
- package/dist/esm/utils/gemini_schema_util.js +144 -14
- package/dist/esm/utils/id_provider.js +33 -0
- package/dist/esm/utils/logger_node.js +4 -0
- package/dist/esm/utils/model_name.js +14 -0
- package/dist/esm/utils/output_schema_utils.js +5 -2
- package/dist/esm/utils/simple_zod_to_json.js +13 -31
- package/dist/esm/utils/ssrf_guard.js +55 -15
- package/dist/esm/utils/task.js +1 -1
- 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 +155 -0
- package/dist/types/agents/base_agent.d.ts +14 -0
- package/dist/types/agents/llm_agent.d.ts +5 -1
- package/dist/types/agents/processors/content_processor_utils.d.ts +12 -10
- package/dist/types/agents/processors/nl_planning_processor.d.ts +2 -1
- 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 +20 -3
- package/dist/types/cli/utils/path_validation.d.ts +30 -0
- package/dist/types/code_executors/container_code_executor.d.ts +62 -9
- package/dist/types/common.d.ts +21 -18
- package/dist/types/context/compaction_utils.d.ts +13 -1
- package/dist/types/errors/input_validation_error.d.ts +2 -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 +11 -6
- package/dist/types/plugins/base_plugin.d.ts +50 -31
- 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 +5 -2
- package/dist/types/sessions/database_session_service.d.ts +17 -1
- package/dist/types/sessions/db/operations.d.ts +2 -1
- package/dist/types/sessions/db/schema.d.ts +5 -3
- package/dist/types/sessions/stale_session_error.d.ts +21 -0
- package/dist/types/skills/loader.d.ts +3 -2
- 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/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 +35 -12
- 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 +7 -6
- 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_tool.d.ts +10 -3
- package/dist/types/tools/google_api_tool/google_api_toolset.d.ts +57 -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 +18 -1
- package/dist/types/tools/load_memory_tool.d.ts +32 -4
- 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/openapi_spec_parser.d.ts +12 -0
- package/dist/types/tools/openapi_tool/openapi_spec_parser/operation_parser.d.ts +15 -3
- 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 +154 -0
- package/dist/types/utils/async_queue.d.ts +14 -0
- package/dist/types/utils/client_labels.d.ts +2 -1
- 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 +29 -0
- package/dist/types/utils/id_provider.d.ts +43 -0
- package/dist/types/utils/model_name.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/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 +94 -88
- package/dist/web/index_web.js.map +4 -4
- package/package.json +43 -38
- package/dist/cjs/agents/remote_agent.js +0 -187
- package/dist/cjs/telemetry/google_cloud.js +0 -116
- package/dist/cjs/telemetry/tracing.js +0 -350
- 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/telemetry/google_cloud.js +0 -99
- package/dist/esm/telemetry/setup.js +0 -89
- package/dist/esm/telemetry/tracing.js +0 -315
- 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/telemetry/google_cloud.d.ts +0 -9
- package/dist/types/telemetry/tracing.d.ts +0 -129
- 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
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { Content } from '@google/genai';
|
|
7
|
+
import type { BaseAgent } from '../../agents/base_agent.js';
|
|
8
|
+
import type { InvocationContext } from '../../agents/invocation_context.js';
|
|
9
|
+
import type { RunConfig } from '../../agents/run_config.js';
|
|
10
|
+
import type { Event } from '../../events/event.js';
|
|
11
|
+
import type { LlmRequest } from '../../models/llm_request.js';
|
|
12
|
+
import type { LlmResponse } from '../../models/llm_response.js';
|
|
13
|
+
import type { ContextCompactionTrigger } from '../../plugins/base_plugin.js';
|
|
14
|
+
import type { Skill } from '../../skills/skill.js';
|
|
15
|
+
import type { BaseTool } from '../../tools/base_tool.js';
|
|
16
|
+
import type { BaseNode } from '../../workflow/base_node.js';
|
|
17
|
+
import { type IncomingHeaders } from './internal/trace/propagation.js';
|
|
18
|
+
export type { ContentCapturingMode, ExperimentalFeature, TelemetryConfig, } from './internal/common/config.js';
|
|
19
|
+
export type { IncomingHeaders } from './internal/trace/propagation.js';
|
|
20
|
+
/** Parameters for starting an invocation with {@link recordInvocation}. */
|
|
21
|
+
export interface RecordInvocationParams {
|
|
22
|
+
/** The runner's root agent or workflow. */
|
|
23
|
+
readonly entrypoint: BaseNode;
|
|
24
|
+
/** The session the invocation runs in. */
|
|
25
|
+
readonly sessionId: string;
|
|
26
|
+
/** The run's config, whose `telemetry` overrides apply to the invocation. */
|
|
27
|
+
readonly runConfig?: RunConfig;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Wraps a runner invocation in its root `invoke_workflow {entrypoint}` span.
|
|
31
|
+
*
|
|
32
|
+
* Every workflow started inside the invocation is nested below this span. A
|
|
33
|
+
* workflow entrypoint runs inside it rather than opening a second one.
|
|
34
|
+
*/
|
|
35
|
+
export declare function recordInvocation<T>({ entrypoint, sessionId, runConfig }: RecordInvocationParams, createGenerator: () => AsyncGenerator<T, void, void>): AsyncGenerator<T, void, void>;
|
|
36
|
+
/** Parameters for starting an `invoke_agent` instrumentation scope. */
|
|
37
|
+
export interface RecordAgentInvocationParams {
|
|
38
|
+
readonly agent: BaseAgent;
|
|
39
|
+
/** The context the agent was invoked with. */
|
|
40
|
+
readonly invocationContext: InvocationContext;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Wraps an agent invocation in an `invoke_agent {agent.name}` span.
|
|
44
|
+
*/
|
|
45
|
+
export declare function recordAgentInvocation<T>({ agent, invocationContext }: RecordAgentInvocationParams, createGenerator: () => AsyncGenerator<T, void, void>): AsyncGenerator<T, void, void>;
|
|
46
|
+
/** Parameters for recording one model call with {@link recordInference}. */
|
|
47
|
+
export interface RecordInferenceParams {
|
|
48
|
+
readonly invocationContext: InvocationContext;
|
|
49
|
+
readonly llmRequest: LlmRequest;
|
|
50
|
+
/** The event the model's responses are merged into. */
|
|
51
|
+
readonly modelResponseEvent: Event;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Wraps one model call in a `generate_content {model}` span and its
|
|
55
|
+
* `gen_ai.client.inference.operation.details` log record.
|
|
56
|
+
*
|
|
57
|
+
* Returns the model's responses unchanged. The span is current only while the
|
|
58
|
+
* model stream is being pulled, never while the caller handles a response, and
|
|
59
|
+
* it ends at the first response that reports a finish reason, before that
|
|
60
|
+
* response is returned. If the stream ends, fails or is closed before one
|
|
61
|
+
* arrives, the span ends then. Each call emits exactly one log record, while
|
|
62
|
+
* the span is still open.
|
|
63
|
+
*/
|
|
64
|
+
export declare function recordInference(params: RecordInferenceParams, createStream: () => AsyncGenerator<LlmResponse, void, void>): AsyncGenerator<LlmResponse, void, void>;
|
|
65
|
+
/** Parameters for recording a live `send_data` span. */
|
|
66
|
+
export interface RecordSendDataParams {
|
|
67
|
+
readonly invocationContext: InvocationContext;
|
|
68
|
+
readonly eventId: string;
|
|
69
|
+
readonly data: Content[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Wraps an async operation in a `send_data` span and records the live data
|
|
73
|
+
* payload attributes when the operation completes.
|
|
74
|
+
*/
|
|
75
|
+
export declare function recordSendData<T>(params: RecordSendDataParams, fn: () => Promise<T>): Promise<T>;
|
|
76
|
+
/** Parameters for starting an `execute_tool` instrumentation scope. */
|
|
77
|
+
export interface RecordToolExecutionParams {
|
|
78
|
+
readonly tool: BaseTool;
|
|
79
|
+
readonly args: Record<string, unknown>;
|
|
80
|
+
readonly invocationContext: InvocationContext;
|
|
81
|
+
}
|
|
82
|
+
/** Parameters for recording a completed tool execution on its scope. */
|
|
83
|
+
export interface ToolExecutionSuccessParams {
|
|
84
|
+
readonly functionResponseEvent?: Event;
|
|
85
|
+
/**
|
|
86
|
+
* The raw value returned by the tool before normalization into a
|
|
87
|
+
* `functionResponse` event, used to inspect any response-reported error type.
|
|
88
|
+
*/
|
|
89
|
+
readonly rawResult: unknown;
|
|
90
|
+
}
|
|
91
|
+
/** Scope handle passed to the body of {@link recordToolExecution}. */
|
|
92
|
+
export interface ToolExecutionScope {
|
|
93
|
+
/**
|
|
94
|
+
* Records the tool's response, including an error the tool reported in it
|
|
95
|
+
* rather than throwing.
|
|
96
|
+
*/
|
|
97
|
+
recordSuccess(params: ToolExecutionSuccessParams): void;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Wraps a single tool call in an `execute_tool {tool.name}` span.
|
|
101
|
+
*
|
|
102
|
+
* An error that escapes `fn` is recorded on the span as `error.type` and an
|
|
103
|
+
* ERROR status, as is an error the tool reports in its response. Skill tools
|
|
104
|
+
* running inside report to the span through {@link recordSkillActivity}.
|
|
105
|
+
*/
|
|
106
|
+
export declare function recordToolExecution<T>({ tool, args, invocationContext }: RecordToolExecutionParams, fn: (scope: ToolExecutionScope) => Promise<T>): Promise<T>;
|
|
107
|
+
/** What a skill tool is doing, reported with {@link recordSkillActivity}. */
|
|
108
|
+
export type SkillActivity = {
|
|
109
|
+
readonly kind: 'load';
|
|
110
|
+
readonly skillName: string;
|
|
111
|
+
} | {
|
|
112
|
+
readonly kind: 'resource';
|
|
113
|
+
readonly skillName: string;
|
|
114
|
+
readonly resourcePath: string;
|
|
115
|
+
} | {
|
|
116
|
+
readonly kind: 'script';
|
|
117
|
+
readonly skillName: string;
|
|
118
|
+
readonly scriptPath: string;
|
|
119
|
+
};
|
|
120
|
+
/** Handle returned by {@link recordSkillActivity}. */
|
|
121
|
+
export interface SkillActivityScope {
|
|
122
|
+
/** Records the skill the tool resolved. */
|
|
123
|
+
recordSkill(skill: Skill): void;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Reports what a skill tool is doing to the `execute_tool` span it runs
|
|
127
|
+
* under, which is renamed after the skill and records its attributes when the
|
|
128
|
+
* tool call ends.
|
|
129
|
+
*
|
|
130
|
+
* Does nothing outside a tool call. A second report in the same tool call
|
|
131
|
+
* replaces the first.
|
|
132
|
+
*/
|
|
133
|
+
export declare function recordSkillActivity(activity: SkillActivity): SkillActivityScope;
|
|
134
|
+
/** Parameters for recording a merged tool calls span. */
|
|
135
|
+
export interface RecordMergedToolCallsParams {
|
|
136
|
+
/** The id of the event that merges the parallel tool responses. */
|
|
137
|
+
readonly responseEventId: string;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Starts and immediately ends an `execute_tool (merged)` span for parallel
|
|
141
|
+
* tool calls whose responses were merged into one event.
|
|
142
|
+
*/
|
|
143
|
+
export declare function recordMergedToolCalls({ responseEventId, }: RecordMergedToolCallsParams): void;
|
|
144
|
+
/**
|
|
145
|
+
* A synchronously started span scope for workflow orchestration.
|
|
146
|
+
*
|
|
147
|
+
* Workflow and node scopes return this handle instead of wrapping a callback.
|
|
148
|
+
* Their spans must start at the moment the work is scheduled, and the scope
|
|
149
|
+
* must hand the caller's promise back unchanged: an `async` wrapper adds
|
|
150
|
+
* promise ticks, which changes how concurrently scheduled nodes interleave.
|
|
151
|
+
*/
|
|
152
|
+
export interface SyncStartedScope {
|
|
153
|
+
/**
|
|
154
|
+
* Runs `fn` with this scope's span as the active span and returns its result
|
|
155
|
+
* as is, without awaiting it.
|
|
156
|
+
*/
|
|
157
|
+
run<T>(fn: () => T): T;
|
|
158
|
+
/**
|
|
159
|
+
* Ends the span, with an ERROR status when `error` is given. Safe to call
|
|
160
|
+
* more than once; only the first call counts.
|
|
161
|
+
*/
|
|
162
|
+
end(error?: unknown): void;
|
|
163
|
+
}
|
|
164
|
+
/** Parameters for starting an `invoke_workflow` instrumentation scope. */
|
|
165
|
+
export interface RecordWorkflowInvocationParams {
|
|
166
|
+
readonly workflow: BaseNode;
|
|
167
|
+
readonly sessionId: string;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Starts the `invoke_workflow {workflow.name}` scope of a workflow run,
|
|
171
|
+
* synchronously.
|
|
172
|
+
*
|
|
173
|
+
* The workflow the runner was entered at runs in the runner's span instead,
|
|
174
|
+
* so its scope opens nothing. A workflow started inside another workflow is
|
|
175
|
+
* marked nested. The caller runs the orchestration through `scope.run` and
|
|
176
|
+
* calls `scope.end()` once it settles.
|
|
177
|
+
*/
|
|
178
|
+
export declare function recordWorkflowInvocation({ workflow, sessionId, }: RecordWorkflowInvocationParams): SyncStartedScope;
|
|
179
|
+
/** Parameters for starting a workflow node's instrumentation scope. */
|
|
180
|
+
export interface RecordNodeInvocationParams {
|
|
181
|
+
readonly node: BaseNode;
|
|
182
|
+
/** The name the node runs under, which may differ from `node.name`. */
|
|
183
|
+
readonly nodeName: string;
|
|
184
|
+
readonly sessionId: string;
|
|
185
|
+
}
|
|
186
|
+
/** Scope handle returned by {@link recordNodeInvocation}. */
|
|
187
|
+
export interface NodeInvocationScope extends SyncStartedScope {
|
|
188
|
+
/** Records an event the node emitted. */
|
|
189
|
+
recordEvent(event: Event): void;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Starts the scope of one workflow node run, synchronously.
|
|
193
|
+
*
|
|
194
|
+
* A plain node runs in an `invoke_node {nodeName}` span that records the ids
|
|
195
|
+
* of the events it emitted. An agent or workflow node opens no node span: its
|
|
196
|
+
* own `invoke_agent` or `invoke_workflow` span stands for it.
|
|
197
|
+
*
|
|
198
|
+
* The span's parent is the span active at the call, so call this when the node
|
|
199
|
+
* is scheduled. The caller runs the node body through `scope.run` and calls
|
|
200
|
+
* `scope.end()` when the node work finishes.
|
|
201
|
+
*/
|
|
202
|
+
export declare function recordNodeInvocation({ node, nodeName, sessionId, }: RecordNodeInvocationParams): NodeInvocationScope;
|
|
203
|
+
/** Parameters for recording a context compaction. */
|
|
204
|
+
export interface RecordCompactionParams {
|
|
205
|
+
readonly invocationContext: InvocationContext;
|
|
206
|
+
readonly trigger: ContextCompactionTrigger;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Wraps a context compaction in a `compact_events {trigger}` span, recording
|
|
210
|
+
* the summary event it added to the session.
|
|
211
|
+
*/
|
|
212
|
+
export declare function recordCompaction<T>({ invocationContext, trigger }: RecordCompactionParams, fn: () => Promise<T>): Promise<T>;
|
|
213
|
+
/** A `fetch` as the MCP HTTP transports call it. */
|
|
214
|
+
export type McpFetch = (url: string | URL, init?: Parameters<typeof globalThis.fetch>[1]) => Promise<Response>;
|
|
215
|
+
/**
|
|
216
|
+
* Returns a `fetch` for an MCP HTTP transport that reports each exchange as
|
|
217
|
+
* an `adk.experimental.mcp.http.client.response.end` log record, parented to
|
|
218
|
+
* the span active when the request was sent.
|
|
219
|
+
*
|
|
220
|
+
* Returns `fetch` unchanged, `undefined` included, unless the experimental
|
|
221
|
+
* `mcp` telemetry feature is enabled in the environment, which is read when
|
|
222
|
+
* this is called, so call it when the transport is built. The returned
|
|
223
|
+
* function sends each request with `fetch`, or the global `fetch` when that is
|
|
224
|
+
* `undefined`, and resolves with its response as soon as it arrives: the
|
|
225
|
+
* record is written in the background, and a failure to write it is logged,
|
|
226
|
+
* never thrown.
|
|
227
|
+
*/
|
|
228
|
+
export declare function instrumentMcpFetch(fetch: McpFetch | undefined): McpFetch | undefined;
|
|
229
|
+
/** A `fetch`-compatible function. */
|
|
230
|
+
export type FetchFunction = (input: Parameters<typeof globalThis.fetch>[0], init?: Parameters<typeof globalThis.fetch>[1]) => Promise<Response>;
|
|
231
|
+
/**
|
|
232
|
+
* Returns a `fetch` that sends the active trace context with each request.
|
|
233
|
+
*
|
|
234
|
+
* At each call, the globally registered propagator writes the active context
|
|
235
|
+
* into the request headers: W3C `traceparent` and `tracestate` by default. A
|
|
236
|
+
* header the caller already sets is kept. When the propagator writes nothing,
|
|
237
|
+
* for example with no active trace, the request is sent with its arguments
|
|
238
|
+
* unchanged. A propagator error is logged, never thrown.
|
|
239
|
+
*
|
|
240
|
+
* @param fetchImpl The `fetch` that sends the request. Defaults to the global
|
|
241
|
+
* `fetch`, read at each call.
|
|
242
|
+
*/
|
|
243
|
+
export declare function propagateTraceContext(fetchImpl?: FetchFunction): FetchFunction;
|
|
244
|
+
/**
|
|
245
|
+
* Runs `fn` in the trace context that an incoming request carries.
|
|
246
|
+
*
|
|
247
|
+
* When no span is active, the globally registered propagator reads the
|
|
248
|
+
* headers (W3C `traceparent` and `tracestate` by default), and a valid remote
|
|
249
|
+
* span becomes the parent of the invocation spans `fn` starts. An already
|
|
250
|
+
* active span, such as an HTTP server span or a remote parent set earlier,
|
|
251
|
+
* stays the parent, and the headers are ignored. Missing or malformed headers
|
|
252
|
+
* leave the context unchanged; a propagator error is logged, never thrown.
|
|
253
|
+
*
|
|
254
|
+
* @param headers The incoming request headers, such as Node's
|
|
255
|
+
* `IncomingMessage.headers`.
|
|
256
|
+
* @param fn The request handler to run.
|
|
257
|
+
* @returns What `fn` returns.
|
|
258
|
+
*/
|
|
259
|
+
export declare function runWithRemoteTraceContext<T>(headers: IncomingHeaders, fn: () => T): T;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type Context } from '@opentelemetry/api';
|
|
7
|
+
import type { ResolvedTelemetryConfig } from './config.js';
|
|
8
|
+
import { TokenUsage } from './token_usage.js';
|
|
9
|
+
declare const WORKFLOW_FRAME_SYMBOL: unique symbol;
|
|
10
|
+
/** An accumulator's totals at flush time. */
|
|
11
|
+
export interface Totals {
|
|
12
|
+
/** `undefined` until a model call reports usage (not the same as zero). */
|
|
13
|
+
tokens?: TokenUsage;
|
|
14
|
+
inferenceCalls: number;
|
|
15
|
+
toolCalls: number;
|
|
16
|
+
skillLoads: number;
|
|
17
|
+
compactions: number;
|
|
18
|
+
}
|
|
19
|
+
/** State accumulated across one agent invocation or one workflow. */
|
|
20
|
+
export interface Accumulator {
|
|
21
|
+
readonly totals: Totals;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* State accumulated across one `invoke_workflow`, root or nested.
|
|
25
|
+
*
|
|
26
|
+
* The `parent` chain is walked when a call records against every enclosing
|
|
27
|
+
* workflow; its presence is what `gen_ai.workflow.nested` reports.
|
|
28
|
+
*/
|
|
29
|
+
export interface WorkflowFrame extends Accumulator {
|
|
30
|
+
readonly [WORKFLOW_FRAME_SYMBOL]: true;
|
|
31
|
+
readonly parent: WorkflowFrame | undefined;
|
|
32
|
+
/** The agent or workflow the turn entered at, inherited by nested workflows. */
|
|
33
|
+
readonly rootAgentName: string;
|
|
34
|
+
readonly workflowName: string;
|
|
35
|
+
/** The config the turn was claimed under, inherited by nested workflows. */
|
|
36
|
+
readonly config: ResolvedTelemetryConfig;
|
|
37
|
+
/**
|
|
38
|
+
* The runner's workflow entrypoint, which runs inside this frame instead of
|
|
39
|
+
* opening its own. Cleared once that workflow has claimed it.
|
|
40
|
+
*/
|
|
41
|
+
entrypoint: object | undefined;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Opens an agent accumulator frame on `parentContext`, so model and tool calls
|
|
45
|
+
* running inside count their exclusive totals against this agent invocation.
|
|
46
|
+
*/
|
|
47
|
+
export declare function openAgentFrame(parentContext?: Context): {
|
|
48
|
+
readonly frame: Accumulator;
|
|
49
|
+
readonly context: Context;
|
|
50
|
+
};
|
|
51
|
+
/** Parameters for {@link openWorkflowFrame}. */
|
|
52
|
+
export interface OpenWorkflowFrameParams {
|
|
53
|
+
readonly workflowName: string;
|
|
54
|
+
/** The config to use when this is the root workflow frame. */
|
|
55
|
+
readonly config: ResolvedTelemetryConfig;
|
|
56
|
+
readonly entrypoint?: object;
|
|
57
|
+
readonly parentContext?: Context;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Opens a workflow accumulator frame on `parentContext`, linked to any
|
|
61
|
+
* enclosing workflow frame and inheriting its root agent name and telemetry
|
|
62
|
+
* config.
|
|
63
|
+
*/
|
|
64
|
+
export declare function openWorkflowFrame({ workflowName, config, entrypoint, parentContext, }: OpenWorkflowFrameParams): {
|
|
65
|
+
readonly frame: WorkflowFrame;
|
|
66
|
+
readonly context: Context;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Hands the runner's entrypoint frame to the workflow it was opened for, once.
|
|
70
|
+
*
|
|
71
|
+
* @returns The context to run the workflow under, or `undefined` when
|
|
72
|
+
* `workflow` is not the unclaimed entrypoint of the enclosing frame.
|
|
73
|
+
*/
|
|
74
|
+
export declare function claimEntrypointWorkflowFrame(workflow: object, ctx?: Context): Context | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Every accumulator a call belongs to, captured from the context when the call
|
|
77
|
+
* starts: the innermost agent (exclusive) and each enclosing workflow
|
|
78
|
+
* (inclusive).
|
|
79
|
+
*/
|
|
80
|
+
export interface CapturedAccumulators {
|
|
81
|
+
addInferenceCall(): void;
|
|
82
|
+
addToolCall(): void;
|
|
83
|
+
addSkillLoad(): void;
|
|
84
|
+
addCompaction(): void;
|
|
85
|
+
addTokens(usage: TokenUsage): void;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Captures the active agent and workflow accumulators from `ctx`.
|
|
89
|
+
*/
|
|
90
|
+
export declare function captureAccumulators(ctx?: Context): CapturedAccumulators;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/** OpenTelemetry GenAI semantic-convention attribute keys. */
|
|
7
|
+
export declare enum GenAiAttr {
|
|
8
|
+
AGENT_DESCRIPTION = "gen_ai.agent.description",
|
|
9
|
+
AGENT_NAME = "gen_ai.agent.name",
|
|
10
|
+
CONVERSATION_ID = "gen_ai.conversation.id",
|
|
11
|
+
OPERATION_NAME = "gen_ai.operation.name",
|
|
12
|
+
PROVIDER_NAME = "gen_ai.provider.name",
|
|
13
|
+
SYSTEM = "gen_ai.system",
|
|
14
|
+
WORKFLOW_NAME = "gen_ai.workflow.name",
|
|
15
|
+
WORKFLOW_NESTED = "gen_ai.workflow.nested",
|
|
16
|
+
TOOL_CALL_ID = "gen_ai.tool.call.id",
|
|
17
|
+
TOOL_CALL_ARGUMENTS = "gen_ai.tool.call.arguments",
|
|
18
|
+
TOOL_CALL_RESULT = "gen_ai.tool.call.result",
|
|
19
|
+
TOOL_DEFINITIONS = "gen_ai.tool.definitions",
|
|
20
|
+
TOOL_DESCRIPTION = "gen_ai.tool.description",
|
|
21
|
+
TOOL_NAME = "gen_ai.tool.name",
|
|
22
|
+
TOOL_TYPE = "gen_ai.tool.type",
|
|
23
|
+
REQUEST_MODEL = "gen_ai.request.model",
|
|
24
|
+
REQUEST_TOP_P = "gen_ai.request.top_p",
|
|
25
|
+
REQUEST_MAX_TOKENS = "gen_ai.request.max_tokens",
|
|
26
|
+
RESPONSE_FINISH_REASONS = "gen_ai.response.finish_reasons",
|
|
27
|
+
INPUT_MESSAGES = "gen_ai.input.messages",
|
|
28
|
+
OUTPUT_MESSAGES = "gen_ai.output.messages",
|
|
29
|
+
SYSTEM_INSTRUCTIONS = "gen_ai.system_instructions",
|
|
30
|
+
USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens",
|
|
31
|
+
USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens",
|
|
32
|
+
USAGE_CACHE_READ_INPUT_TOKENS = "gen_ai.usage.cache_read.input_tokens",
|
|
33
|
+
USAGE_REASONING_OUTPUT_TOKENS = "gen_ai.usage.reasoning.output_tokens",
|
|
34
|
+
SKILL_NAME = "gen_ai.skill.name",
|
|
35
|
+
SKILL_DESCRIPTION = "gen_ai.skill.description",
|
|
36
|
+
SKILL_RESOURCE_NAME = "gen_ai.skill.resource.name",
|
|
37
|
+
COMPACTION_TRIGGER = "gen_ai.compaction.trigger",
|
|
38
|
+
COMPACTION_EVENT_COUNT = "gen_ai.compaction.event_count",
|
|
39
|
+
COMPACTION_RESULT_EVENT_ID = "gen_ai.compaction.result_event_id",
|
|
40
|
+
COMPACTION_START_TIMESTAMP = "gen_ai.compaction.start_timestamp",
|
|
41
|
+
COMPACTION_END_TIMESTAMP = "gen_ai.compaction.end_timestamp"
|
|
42
|
+
}
|
|
43
|
+
/** ADK-specific attribute keys outside the GenAI semantic conventions. */
|
|
44
|
+
export declare enum AdkAttr {
|
|
45
|
+
SKILL_ADDITIONAL_TOOLS = "adk.skill.additional_tools",
|
|
46
|
+
EXPERIMENTAL_ROOT_AGENT_NAME = "adk.experimental.root_agent.name",
|
|
47
|
+
EXPERIMENTAL_GROUNDING_QUERY_COUNT = "adk.experimental.grounding.query_count",
|
|
48
|
+
EXPERIMENTAL_GROUNDING_CHUNK_COUNT = "adk.experimental.grounding.chunk_count",
|
|
49
|
+
EXPERIMENTAL_GROUNDING_WEB_SEARCH_QUERIES = "adk.experimental.grounding.web_search_queries",
|
|
50
|
+
EXPERIMENTAL_GROUNDING_SOURCE_URIS = "adk.experimental.grounding.source_uris"
|
|
51
|
+
}
|
|
52
|
+
/** GCP Vertex agent attribute keys, consumed by the Vertex trace UI. */
|
|
53
|
+
export declare enum GcpAttr {
|
|
54
|
+
INVOCATION_ID = "gcp.vertex.agent.invocation_id",
|
|
55
|
+
EVENT_ID = "gcp.vertex.agent.event_id",
|
|
56
|
+
ASSOCIATED_EVENT_IDS = "gcp.vertex.agent.associated_event_ids",
|
|
57
|
+
DATA = "gcp.vertex.agent.data"
|
|
58
|
+
}
|
|
59
|
+
/** OpenTelemetry HTTP client semantic-convention keys. */
|
|
60
|
+
export declare enum HttpAttr {
|
|
61
|
+
REQUEST_METHOD = "http.request.method",
|
|
62
|
+
RESPONSE_STATUS_CODE = "http.response.status_code",
|
|
63
|
+
REQUEST_BODY_CONTENT = "http.request.body.content",
|
|
64
|
+
RESPONSE_BODY_CONTENT = "http.response.body.content",
|
|
65
|
+
/** Prefix of `http.request.header.<lowercased name>`. */
|
|
66
|
+
REQUEST_HEADER_PREFIX = "http.request.header.",
|
|
67
|
+
/** Prefix of `http.response.header.<lowercased name>`. */
|
|
68
|
+
RESPONSE_HEADER_PREFIX = "http.response.header.",
|
|
69
|
+
URL_FULL = "url.full",
|
|
70
|
+
SERVER_ADDRESS = "server.address",
|
|
71
|
+
SERVER_PORT = "server.port"
|
|
72
|
+
}
|
|
73
|
+
/** OpenTelemetry MCP semantic-convention keys. */
|
|
74
|
+
export declare enum McpAttr {
|
|
75
|
+
SESSION_ID = "mcp.session.id",
|
|
76
|
+
PROTOCOL_VERSION = "mcp.protocol.version"
|
|
77
|
+
}
|
|
78
|
+
/** Standard OpenTelemetry error classification attribute key. */
|
|
79
|
+
export declare const ERROR_TYPE_ATTR = "error.type";
|
|
80
|
+
/** Standard OpenTelemetry end-user identifier attribute key. */
|
|
81
|
+
export declare const USER_ID_ATTR = "user.id";
|
|
82
|
+
/**
|
|
83
|
+
* Attribute on the top span of a trace that holds the caller's `traceparent`
|
|
84
|
+
* header, so a support request can be matched to the trace.
|
|
85
|
+
*/
|
|
86
|
+
export declare const SUPPORT_ID_ATTR = "supportID";
|
|
87
|
+
/** Instrumentation scope name identifying ADK as the emitter. */
|
|
88
|
+
export declare const GEN_AI_SYSTEM_VALUE = "gcp.vertex.agent";
|
|
89
|
+
/** Schema URL of the OpenTelemetry semantic conventions ADK emits. */
|
|
90
|
+
export declare const SCHEMA_URL = "https://opentelemetry.io/schemas/1.44.0";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Where GenAI message content is recorded, as named by
|
|
8
|
+
* `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`.
|
|
9
|
+
*/
|
|
10
|
+
export type ContentCapturingMode = 'NO_CONTENT' | 'EVENT_ONLY' | 'SPAN_ONLY' | 'SPAN_AND_EVENT';
|
|
11
|
+
/** A named group of experimental telemetry that can be enabled on its own. */
|
|
12
|
+
export type ExperimentalFeature = 'skills' | 'workflow' | 'context_cache' | 'grounding' | 'mcp' | 'token_usage' | 'compaction';
|
|
13
|
+
/**
|
|
14
|
+
* Per-run telemetry overrides, set through `RunConfig.telemetry`.
|
|
15
|
+
*
|
|
16
|
+
* A field left unset falls back to the environment variable it overrides.
|
|
17
|
+
* When `ADK_TELEMETRY_IGNORE_RUN_CONFIG` is `true` or `1`, every field is
|
|
18
|
+
* ignored and the environment decides.
|
|
19
|
+
*/
|
|
20
|
+
export interface TelemetryConfig {
|
|
21
|
+
/** Overrides `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT`. */
|
|
22
|
+
readonly captureMessageContent?: ContentCapturingMode;
|
|
23
|
+
/**
|
|
24
|
+
* Overrides `ADK_EXPERIMENTAL_TELEMETRY`. `true` enables every experimental
|
|
25
|
+
* feature for the run, and `false` disables every one, including those named
|
|
26
|
+
* in `ADK_EXPERIMENTAL_TELEMETRY_FEATURES` or `experimentalFeaturesOptIn`.
|
|
27
|
+
*/
|
|
28
|
+
readonly adkExperimentalTelemetryOptIn?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Overrides `ADK_EXPERIMENTAL_TELEMETRY_FEATURES`: exactly these features
|
|
31
|
+
* are enabled for the run. Unrecognized names are ignored, and a list with
|
|
32
|
+
* no recognized name falls back to the environment.
|
|
33
|
+
*/
|
|
34
|
+
readonly experimentalFeaturesOptIn?: readonly ExperimentalFeature[];
|
|
35
|
+
}
|
|
36
|
+
/** The telemetry decisions for one scope. */
|
|
37
|
+
export interface ResolvedTelemetryConfig {
|
|
38
|
+
/** Where message content is recorded. */
|
|
39
|
+
readonly contentCapturingMode: ContentCapturingMode;
|
|
40
|
+
/** Whether every experimental feature is enabled. */
|
|
41
|
+
readonly experimentalTelemetry: boolean;
|
|
42
|
+
/** Features enabled one by one. */
|
|
43
|
+
readonly experimentalFeatures: ReadonlySet<ExperimentalFeature>;
|
|
44
|
+
}
|
|
45
|
+
/** Whether an environment variable is `true` or `1`, ignoring case and spaces. */
|
|
46
|
+
export declare function isTruthyEnv(name: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Resolves the telemetry configuration of one scope.
|
|
49
|
+
*
|
|
50
|
+
* Each value comes from `overrides` when it sets it, else from its environment
|
|
51
|
+
* variable, else from its default. `ADK_TELEMETRY_IGNORE_RUN_CONFIG` makes the
|
|
52
|
+
* environment win over every override. The environment is read on each call
|
|
53
|
+
* rather than at import, so a change to it applies to the next scope.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveTelemetryConfig(overrides?: TelemetryConfig): ResolvedTelemetryConfig;
|
|
56
|
+
/** Whether message content goes on log records (`EVENT_ONLY`, `SPAN_AND_EVENT`). */
|
|
57
|
+
export declare function shouldAddContentToLogs(config: ResolvedTelemetryConfig): boolean;
|
|
58
|
+
/** Whether message content goes on spans (`SPAN_ONLY`, `SPAN_AND_EVENT`). */
|
|
59
|
+
export declare function shouldAddContentToSpans(config: ResolvedTelemetryConfig): boolean;
|
|
60
|
+
/** Whether the named experimental feature is enabled. */
|
|
61
|
+
export declare function isExperimentalFeatureEnabled(config: ResolvedTelemetryConfig, feature: ExperimentalFeature): boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Normalizes a candidate error classification by trimming strings and
|
|
8
|
+
* stringifying finite numbers.
|
|
9
|
+
*
|
|
10
|
+
* @param value The candidate classification value.
|
|
11
|
+
* @returns The non-empty trimmed classification string, or undefined if invalid.
|
|
12
|
+
*/
|
|
13
|
+
export declare function normalizeErrorClassification(value: unknown): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Resolves a stable error classification suitable for the OpenTelemetry
|
|
16
|
+
* `error.type` attribute without using the potentially sensitive error message.
|
|
17
|
+
*
|
|
18
|
+
* @param error The thrown value.
|
|
19
|
+
* @returns The explicit ADK error type, GenAI API status, or error class name.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveErrorType(error: unknown): string;
|
|
22
|
+
/**
|
|
23
|
+
* Gets an explicitly reported error type from a tool response object.
|
|
24
|
+
*
|
|
25
|
+
* Tools may return an error payload instead of throwing. Only the dedicated
|
|
26
|
+
* error type or error code field is copied to telemetry; the payload itself is
|
|
27
|
+
* never used as the error classification.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getToolResponseErrorType(result: unknown): string | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { FinishReason } from '@google/genai';
|
|
7
|
+
/**
|
|
8
|
+
* Whether the model reported why generation stopped.
|
|
9
|
+
*
|
|
10
|
+
* The unspecified value is the proto3 zero value, so a response that carries
|
|
11
|
+
* it has not reported a reason.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isReportedFinishReason(finishReason: FinishReason | undefined): finishReason is FinishReason;
|
|
14
|
+
/**
|
|
15
|
+
* Maps a finish reason to the `finish_reason` of a GenAI output message, or
|
|
16
|
+
* `''` when none was reported.
|
|
17
|
+
*/
|
|
18
|
+
export declare function toOutputMessageFinishReason(finishReason: FinishReason | undefined): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { AnyValue, AnyValueMap } from '@opentelemetry/api-logs';
|
|
7
|
+
import type { LlmRequest } from '../../../../models/llm_request.js';
|
|
8
|
+
import type { LlmResponse } from '../../../../models/llm_response.js';
|
|
9
|
+
import { GenAiAttr } from './attributes.js';
|
|
10
|
+
/** Message content and tool definitions of one model call, by attribute key. */
|
|
11
|
+
export type OperationDetails = Partial<Record<GenAiAttr.INPUT_MESSAGES | GenAiAttr.OUTPUT_MESSAGES | GenAiAttr.SYSTEM_INSTRUCTIONS | GenAiAttr.TOOL_DEFINITIONS, AnyValue[]>>;
|
|
12
|
+
/**
|
|
13
|
+
* Builds the operation details a model request contributes: input messages,
|
|
14
|
+
* system instructions and tool definitions.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildRequestOperationDetails(llmRequest: LlmRequest): OperationDetails;
|
|
17
|
+
/**
|
|
18
|
+
* Builds the output message for one model response, or `undefined` when it
|
|
19
|
+
* carries no content.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildOutputMessage(llmResponse: LlmResponse): AnyValueMap | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the view of the operation details that carries no message content:
|
|
24
|
+
* the tool definitions without their parameter schemas.
|
|
25
|
+
*/
|
|
26
|
+
export declare function withoutContent(details: OperationDetails): OperationDetails;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/** One HTTP request and its response, made safe to record. */
|
|
7
|
+
export interface HttpExchange {
|
|
8
|
+
/** The request method, in upper case. */
|
|
9
|
+
readonly method: string;
|
|
10
|
+
/** The request URL without userinfo, with every query value redacted. */
|
|
11
|
+
readonly url: string;
|
|
12
|
+
/** The URL host name, without IPv6 brackets. */
|
|
13
|
+
readonly serverAddress: string;
|
|
14
|
+
/** The URL port, when the URL names one. */
|
|
15
|
+
readonly serverPort?: number;
|
|
16
|
+
/** The `sessionId` or `session_id` query value of the request URL. */
|
|
17
|
+
readonly querySessionId?: string;
|
|
18
|
+
readonly statusCode: number;
|
|
19
|
+
/** Request headers by lowercased name, with credentials redacted. */
|
|
20
|
+
readonly requestHeaders: ReadonlyMap<string, string>;
|
|
21
|
+
/** Response headers by lowercased name, with credentials redacted. */
|
|
22
|
+
readonly responseHeaders: ReadonlyMap<string, string>;
|
|
23
|
+
/**
|
|
24
|
+
* The request body, truncated. Absent when bodies are not captured, or when
|
|
25
|
+
* the body cannot be read without consuming it.
|
|
26
|
+
*/
|
|
27
|
+
readonly requestBody?: string;
|
|
28
|
+
/**
|
|
29
|
+
* The response body, truncated, or a marker for a body that is not read.
|
|
30
|
+
* Absent when bodies are not captured.
|
|
31
|
+
*/
|
|
32
|
+
readonly responseBody?: string;
|
|
33
|
+
}
|
|
34
|
+
/** Parameters for {@link captureHttpExchange}. */
|
|
35
|
+
export interface CaptureHttpExchangeParams {
|
|
36
|
+
readonly url: string | URL;
|
|
37
|
+
readonly init?: Parameters<typeof fetch>[1];
|
|
38
|
+
readonly response: Response;
|
|
39
|
+
/** Whether to read the request and response bodies. */
|
|
40
|
+
readonly captureBodies: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Captures one HTTP exchange for recording.
|
|
44
|
+
*
|
|
45
|
+
* Everything it needs from `response` is taken before it returns, so the
|
|
46
|
+
* caller may hand the response on as soon as this returns: the response body
|
|
47
|
+
* is read from a clone in the background, and never for an event stream,
|
|
48
|
+
* which does not end.
|
|
49
|
+
*/
|
|
50
|
+
export declare function captureHttpExchange({ url, init, response, captureBodies, }: CaptureHttpExchangeParams): Promise<HttpExchange>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Returns the `gen_ai.system` name of the Gemini backend in use.
|
|
8
|
+
*/
|
|
9
|
+
export declare function guessGeminiSystemName(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Returns the `gen_ai.provider.name` of the provider serving `model`.
|
|
12
|
+
*
|
|
13
|
+
* A `<provider>/<model>` id names its provider in the prefix. Otherwise, and
|
|
14
|
+
* for Gemini models, the name follows the Gemini backend in use.
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveProviderName(model: string | undefined): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Returns a copy of a JSON-like payload with credential secrets removed.
|
|
8
|
+
*
|
|
9
|
+
* Removes the secret fields of anything shaped like an auth credential or auth
|
|
10
|
+
* config, wherever it is nested: a credential object, the arguments and
|
|
11
|
+
* response of a credential request, and the credential-carrying fields of
|
|
12
|
+
* event actions.
|
|
13
|
+
*/
|
|
14
|
+
export declare function redactCredentialSecrets(value: unknown): unknown;
|