@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,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Convert any JavaScript object to a JSON-serializable string.
|
|
8
|
+
*
|
|
9
|
+
* @param obj The object to serialize.
|
|
10
|
+
* @returns The JSON-serialized object string or '<not serializable>' if the object cannot be serialized.
|
|
11
|
+
*/
|
|
12
|
+
export declare function safeJsonSerialize(obj: unknown): string;
|
|
13
|
+
/**
|
|
14
|
+
* Determines whether to add live request content to the `send_data` span.
|
|
15
|
+
*
|
|
16
|
+
* @returns false only when ADK_CAPTURE_MESSAGE_CONTENT_IN_SPANS is explicitly set to 'false' or '0'
|
|
17
|
+
*/
|
|
18
|
+
export declare function shouldAddRequestResponseToSpans(): boolean;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { GenerateContentResponseUsageMetadata } from '@google/genai';
|
|
7
|
+
import type { Attributes } from '@opentelemetry/api';
|
|
8
|
+
/** Description of the `input_tokens` metric bucket. */
|
|
9
|
+
export declare const INPUT_TOKENS_MEANING: string;
|
|
10
|
+
/** Description of the `output_tokens` metric bucket. */
|
|
11
|
+
export declare const OUTPUT_TOKENS_MEANING: string;
|
|
12
|
+
/** Description of the `total_tokens` metric bucket. */
|
|
13
|
+
export declare const TOTAL_TOKENS_MEANING: string;
|
|
14
|
+
/** Description of the `cache_read.input_tokens` metric bucket. */
|
|
15
|
+
export declare const CACHE_READ_INPUT_TOKENS_MEANING = "Input tokens served from a provider-managed cache.";
|
|
16
|
+
/** Description of the `reasoning.output_tokens` metric bucket. */
|
|
17
|
+
export declare const REASONING_OUTPUT_TOKENS_MEANING = "Output tokens spent on reasoning (chain-of-thought / extended thinking).";
|
|
18
|
+
/** Description of the `tool.input_tokens` metric bucket. */
|
|
19
|
+
export declare const TOOL_INPUT_TOKENS_MEANING: string;
|
|
20
|
+
/**
|
|
21
|
+
* GenAI token usage, either one model call's or a sum over several.
|
|
22
|
+
*
|
|
23
|
+
* Input tokens sum the prompt and server-side tool results; output tokens sum
|
|
24
|
+
* candidates and reasoning. A bucket that nothing reported is `undefined`
|
|
25
|
+
* rather than zero: {@link asAttributes} omits it and {@link add} keeps it
|
|
26
|
+
* `undefined` until some call reports it.
|
|
27
|
+
*/
|
|
28
|
+
export declare class TokenUsage {
|
|
29
|
+
input?: number;
|
|
30
|
+
output?: number;
|
|
31
|
+
cacheRead?: number;
|
|
32
|
+
reasoning?: number;
|
|
33
|
+
toolInput?: number;
|
|
34
|
+
constructor(usage?: GenerateContentResponseUsageMetadata);
|
|
35
|
+
/** Folds another call's usage into these totals, bucket by bucket. */
|
|
36
|
+
add(other: TokenUsage): void;
|
|
37
|
+
/**
|
|
38
|
+
* Input plus output tokens, derived from those two rather than taken from
|
|
39
|
+
* the model-reported total.
|
|
40
|
+
*/
|
|
41
|
+
totalTokenUsage(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the GenAI token usage attributes for the reported buckets,
|
|
44
|
+
* omitting `undefined` buckets and preserving `0`.
|
|
45
|
+
*/
|
|
46
|
+
asAttributes(): Attributes;
|
|
47
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type Span } from '@opentelemetry/api';
|
|
7
|
+
import type { LogAttributes } from '@opentelemetry/api-logs';
|
|
8
|
+
/**
|
|
9
|
+
* Emits the `gen_ai.client.inference.operation.details` record of one model
|
|
10
|
+
* call, parented to its `generate_content` span.
|
|
11
|
+
*
|
|
12
|
+
* The span is named explicitly rather than taken from the active context,
|
|
13
|
+
* which need not hold it when the call ends.
|
|
14
|
+
*/
|
|
15
|
+
export declare function emitInferenceOperationDetails(span: Span, attributes: LogAttributes): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type Logger } from '@opentelemetry/api-logs';
|
|
7
|
+
/**
|
|
8
|
+
* Returns the ADK logger from the global `LoggerProvider`.
|
|
9
|
+
*
|
|
10
|
+
* Resolved on every call rather than once at import, so records reach a
|
|
11
|
+
* provider the application registers after importing ADK.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getTelemetryLogger(): Logger;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Context } from '@opentelemetry/api';
|
|
7
|
+
/** What to record about MCP HTTP exchanges, read from the environment. */
|
|
8
|
+
export interface McpHttpExchangeSettings {
|
|
9
|
+
readonly captureBodies: boolean;
|
|
10
|
+
readonly requestHeaderPatterns: readonly RegExp[];
|
|
11
|
+
readonly responseHeaderPatterns: readonly RegExp[];
|
|
12
|
+
}
|
|
13
|
+
/** Reads the MCP HTTP exchange settings from the environment. */
|
|
14
|
+
export declare function readMcpHttpExchangeSettings(): McpHttpExchangeSettings;
|
|
15
|
+
/** Parameters for {@link reportMcpHttpExchange}. */
|
|
16
|
+
export interface ReportMcpHttpExchangeParams {
|
|
17
|
+
readonly url: string | URL;
|
|
18
|
+
readonly init?: Parameters<typeof fetch>[1];
|
|
19
|
+
readonly response: Response;
|
|
20
|
+
readonly settings: McpHttpExchangeSettings;
|
|
21
|
+
/** The context the request was sent in, which parents the record. */
|
|
22
|
+
readonly context: Context;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Emits the `adk.experimental.mcp.http.client.response.end` record of one MCP
|
|
26
|
+
* HTTP exchange.
|
|
27
|
+
*
|
|
28
|
+
* Takes what it needs from `response` before its first await, so the caller
|
|
29
|
+
* can hand the response on at once and leave the returned promise running.
|
|
30
|
+
*/
|
|
31
|
+
export declare function reportMcpHttpExchange({ url, init, response, settings, context, }: ReportMcpHttpExchangeParams): Promise<void>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Totals } from '../common/accumulators.js';
|
|
7
|
+
import { type ResolvedTelemetryConfig } from '../common/config.js';
|
|
8
|
+
/** Advisory bucket boundaries for `gen_ai.invoke_agent.duration`. */
|
|
9
|
+
export declare const AGENT_DURATION_BUCKETS: readonly number[];
|
|
10
|
+
/** Parameters for {@link recordAgentDuration}. */
|
|
11
|
+
export interface RecordAgentDurationParams {
|
|
12
|
+
readonly agentName: string;
|
|
13
|
+
readonly durationSeconds: number;
|
|
14
|
+
readonly errorType?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Records `gen_ai.invoke_agent.duration` at the end of an agent invocation. */
|
|
17
|
+
export declare function recordAgentDuration({ agentName, durationSeconds, errorType, }: RecordAgentDurationParams): void;
|
|
18
|
+
/** Parameters for {@link recordAgentTotals}. */
|
|
19
|
+
export interface RecordAgentTotalsParams {
|
|
20
|
+
readonly agentName: string;
|
|
21
|
+
readonly totals: Totals;
|
|
22
|
+
readonly config: ResolvedTelemetryConfig;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Records the per-agent call, skill-load, and token totals accumulated over
|
|
26
|
+
* one agent invocation.
|
|
27
|
+
*/
|
|
28
|
+
export declare function recordAgentTotals({ agentName, totals, config, }: RecordAgentTotalsParams): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Tells the installed metric reader, if any, that a model call has started.
|
|
8
|
+
*
|
|
9
|
+
* Never throws: a failure in the hook is logged and does not reach the model
|
|
10
|
+
* call that triggered it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function notifyInferenceStart(): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type Attributes, type Histogram, type Meter } from '@opentelemetry/api';
|
|
7
|
+
import { type TokenUsage } from '../common/token_usage.js';
|
|
8
|
+
/**
|
|
9
|
+
* Advisory bucket boundaries for per-invocation and per-workflow call-count
|
|
10
|
+
* histograms. Upper-inclusive, so the leading `0` buckets exact zeros on their
|
|
11
|
+
* own.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CALL_COUNT_BUCKETS: readonly number[];
|
|
14
|
+
/**
|
|
15
|
+
* Advisory bucket boundaries for input, total, cache-read, and tool-input
|
|
16
|
+
* token histograms.
|
|
17
|
+
*/
|
|
18
|
+
export declare const INPUT_TOKEN_BUCKETS: readonly number[];
|
|
19
|
+
/**
|
|
20
|
+
* Advisory bucket boundaries for output and reasoning token histograms.
|
|
21
|
+
*/
|
|
22
|
+
export declare const OUTPUT_TOKEN_BUCKETS: readonly number[];
|
|
23
|
+
/**
|
|
24
|
+
* Lazily builds and caches one set of domain instruments per registered
|
|
25
|
+
* `MeterProvider`, so a provider registered after ADK is imported still
|
|
26
|
+
* receives metrics under the ADK instrumentation scope and schema URL.
|
|
27
|
+
*/
|
|
28
|
+
export declare function cachedInstruments<T>(create: (meter: Meter) => T): () => T;
|
|
29
|
+
/** Parameters for {@link createHistogram}. */
|
|
30
|
+
export interface CreateHistogramParams {
|
|
31
|
+
readonly meter: Meter;
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly unit: string;
|
|
34
|
+
readonly description: string;
|
|
35
|
+
readonly buckets?: readonly number[];
|
|
36
|
+
}
|
|
37
|
+
/** Creates a histogram with optional advisory bucket boundaries. */
|
|
38
|
+
export declare function createHistogram({ meter, name, unit, description, buckets, }: CreateHistogramParams): Histogram;
|
|
39
|
+
/** The six token histograms of one family (`invoke_agent` or `invoke_workflow`). */
|
|
40
|
+
export interface TokenHistograms {
|
|
41
|
+
readonly input: Histogram;
|
|
42
|
+
readonly output: Histogram;
|
|
43
|
+
readonly total: Histogram;
|
|
44
|
+
readonly cacheRead: Histogram;
|
|
45
|
+
readonly reasoning: Histogram;
|
|
46
|
+
readonly toolInput: Histogram;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Builds the six token histograms for `prefix`, interpolating the shared token
|
|
50
|
+
* meaning descriptions with `scopeDescription`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createTokenHistograms(meter: Meter, prefix: string, scopeDescription: string): TokenHistograms;
|
|
53
|
+
/**
|
|
54
|
+
* Records all six token histograms for a scope where at least one model call
|
|
55
|
+
* reported token usage. Unreported buckets record `0`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function recordTokenHistograms(histograms: TokenHistograms, usage: TokenUsage, attributes: Attributes): void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Skill } from '../../../../skills/skill.js';
|
|
7
|
+
import { type ResolvedTelemetryConfig } from '../common/config.js';
|
|
8
|
+
/** Advisory bucket boundaries for `gen_ai.execute_tool.duration`. */
|
|
9
|
+
export declare const TOOL_DURATION_BUCKETS: readonly number[];
|
|
10
|
+
/** Parameters for {@link recordToolDuration}. */
|
|
11
|
+
export interface RecordToolDurationParams {
|
|
12
|
+
readonly agentName: string;
|
|
13
|
+
readonly toolName: string;
|
|
14
|
+
readonly toolType: string;
|
|
15
|
+
readonly durationSeconds: number;
|
|
16
|
+
readonly errorType?: string;
|
|
17
|
+
}
|
|
18
|
+
/** Records `gen_ai.execute_tool.duration` at the end of a tool call. */
|
|
19
|
+
export declare function recordToolDuration({ agentName, toolName, toolType, durationSeconds, errorType, }: RecordToolDurationParams): void;
|
|
20
|
+
/** Parameters for {@link recordSkillLoad}. */
|
|
21
|
+
export interface RecordSkillLoadParams {
|
|
22
|
+
readonly agentName: string;
|
|
23
|
+
readonly skill?: Skill;
|
|
24
|
+
readonly errorType?: string;
|
|
25
|
+
readonly config: ResolvedTelemetryConfig;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Records one `adk.experimental.skill.loads` increment when `skills` is
|
|
29
|
+
* enabled, bounding unresolved skill names to `<hallucinated>`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function recordSkillLoad({ agentName, skill, errorType, config, }: RecordSkillLoadParams): void;
|
|
32
|
+
/** Parameters for {@link recordSkillScriptExecution}. */
|
|
33
|
+
export interface RecordSkillScriptExecutionParams {
|
|
34
|
+
readonly agentName: string;
|
|
35
|
+
readonly skill?: Skill;
|
|
36
|
+
readonly scriptPath: string;
|
|
37
|
+
readonly config: ResolvedTelemetryConfig;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Records one `adk.experimental.skill.script.executions` increment when
|
|
41
|
+
* `skills` is enabled, bounding unresolved skill names and script paths to
|
|
42
|
+
* `<hallucinated>`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function recordSkillScriptExecution({ agentName, skill, scriptPath, config, }: RecordSkillScriptExecutionParams): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Totals } from '../common/accumulators.js';
|
|
7
|
+
import { type ResolvedTelemetryConfig } from '../common/config.js';
|
|
8
|
+
/** Parameters for {@link recordWorkflowDuration}. */
|
|
9
|
+
export interface RecordWorkflowDurationParams {
|
|
10
|
+
readonly workflowName: string;
|
|
11
|
+
readonly durationSeconds: number;
|
|
12
|
+
readonly nested: boolean;
|
|
13
|
+
readonly errorType?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Records `gen_ai.invoke_workflow.duration` at the end of a workflow
|
|
17
|
+
* invocation.
|
|
18
|
+
*/
|
|
19
|
+
export declare function recordWorkflowDuration({ workflowName, durationSeconds, nested, errorType, }: RecordWorkflowDurationParams): void;
|
|
20
|
+
/** Parameters for {@link recordWorkflowTotals}. */
|
|
21
|
+
export interface RecordWorkflowTotalsParams {
|
|
22
|
+
readonly rootAgentName: string;
|
|
23
|
+
readonly workflowName: string;
|
|
24
|
+
readonly nested: boolean;
|
|
25
|
+
readonly totals: Totals;
|
|
26
|
+
readonly config: ResolvedTelemetryConfig;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Records the inclusive call, skill-load, compaction, and token totals for one
|
|
30
|
+
* workflow invocation when the `workflow` experimental feature is enabled.
|
|
31
|
+
*/
|
|
32
|
+
export declare function recordWorkflowTotals({ rootAgentName, workflowName, nested, totals, config, }: RecordWorkflowTotalsParams): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Attributes } from '@opentelemetry/api';
|
|
7
|
+
import type { BaseAgent } from '../../../../agents/base_agent.js';
|
|
8
|
+
/** Parameters for {@link buildAgentInvocationAttributes}. */
|
|
9
|
+
export interface AgentInvocationAttributesParams {
|
|
10
|
+
readonly agent: BaseAgent;
|
|
11
|
+
readonly sessionId: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
/** Builds the attributes of an `invoke_agent` span. */
|
|
14
|
+
export declare function buildAgentInvocationAttributes({ agent, sessionId, }: AgentInvocationAttributesParams): Attributes;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Attributes, Span } from '@opentelemetry/api';
|
|
7
|
+
import type { Event } from '../../../../events/event.js';
|
|
8
|
+
/** Parameters for {@link startCompactionSpan}. */
|
|
9
|
+
export interface StartCompactionSpanParams {
|
|
10
|
+
readonly sessionId: string;
|
|
11
|
+
readonly trigger: string;
|
|
12
|
+
}
|
|
13
|
+
/** Starts a `compact_events {trigger}` span under the active context. */
|
|
14
|
+
export declare function startCompactionSpan({ sessionId, trigger, }: StartCompactionSpanParams): Span;
|
|
15
|
+
/**
|
|
16
|
+
* Builds the result attributes of a compaction from the session events before
|
|
17
|
+
* and after it ran: the summary event it added, the time range it covers, and
|
|
18
|
+
* how many of the earlier events fall in that range.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildCompactionResultAttributes(eventsBefore: readonly Event[], eventsAfter: readonly Event[]): Attributes;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Attributes, Span } from '@opentelemetry/api';
|
|
7
|
+
import type { LlmRequest } from '../../../../models/llm_request.js';
|
|
8
|
+
import type { LlmResponse } from '../../../../models/llm_response.js';
|
|
9
|
+
import { type ResolvedTelemetryConfig } from '../common/config.js';
|
|
10
|
+
import { type OperationDetails } from '../common/genai_messages.js';
|
|
11
|
+
/** Parameters for {@link startInferenceSpan}. */
|
|
12
|
+
export interface StartInferenceSpanParams {
|
|
13
|
+
readonly llmRequest: LlmRequest;
|
|
14
|
+
/** Attributes the span shares with the call's log record. */
|
|
15
|
+
readonly commonAttributes: Attributes;
|
|
16
|
+
}
|
|
17
|
+
/** Starts a `generate_content {model}` span under the active context. */
|
|
18
|
+
export declare function startInferenceSpan({ llmRequest, commonAttributes, }: StartInferenceSpanParams): Span;
|
|
19
|
+
/**
|
|
20
|
+
* Builds the attributes one model response contributes to both the span and
|
|
21
|
+
* the log record: its finish reason and its token usage.
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildResponseAttributes(llmResponse: LlmResponse): Attributes;
|
|
24
|
+
/** Records one model response on its `generate_content` span. */
|
|
25
|
+
export declare function setInferenceResponseAttributes(span: Span, llmResponse: LlmResponse, config: ResolvedTelemetryConfig): void;
|
|
26
|
+
/**
|
|
27
|
+
* Records the operation details of a model call on its span, as JSON: all of
|
|
28
|
+
* them when content capture includes spans, otherwise only the view without
|
|
29
|
+
* message content.
|
|
30
|
+
*/
|
|
31
|
+
export declare function setInferenceOperationDetails(span: Span, details: OperationDetails, config: ResolvedTelemetryConfig): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { Span } from '@opentelemetry/api';
|
|
8
|
+
import type { InvocationContext } from '../../../../agents/invocation_context.js';
|
|
9
|
+
/** Parameters for recording live history `send_data` attributes on a span. */
|
|
10
|
+
export interface SetSendDataAttributesParams {
|
|
11
|
+
/** The invocation context for the current agent run. */
|
|
12
|
+
readonly invocationContext: InvocationContext;
|
|
13
|
+
/** The ID of the event. */
|
|
14
|
+
readonly eventId: string;
|
|
15
|
+
/** A list of content objects. */
|
|
16
|
+
readonly data: Content[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Sets `send_data` attributes on the given span.
|
|
20
|
+
*/
|
|
21
|
+
export declare function setSendDataAttributes(span: Span, { invocationContext, eventId, data }: SetSendDataAttributesParams): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Span } from '@opentelemetry/api';
|
|
7
|
+
import type { BaseNode } from '../../../../workflow/base_node.js';
|
|
8
|
+
/**
|
|
9
|
+
* Whether a node is traced by a span of its own kind rather than by
|
|
10
|
+
* `invoke_node`: an agent opens `invoke_agent` and a workflow
|
|
11
|
+
* `invoke_workflow`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasOwnInvocationSpan(node: BaseNode): boolean;
|
|
14
|
+
/** Parameters for {@link startNodeSpan}. */
|
|
15
|
+
export interface StartNodeSpanParams {
|
|
16
|
+
readonly nodeName: string;
|
|
17
|
+
readonly sessionId: string;
|
|
18
|
+
}
|
|
19
|
+
/** Starts an `invoke_node {nodeName}` span under the active context. */
|
|
20
|
+
export declare function startNodeSpan({ nodeName, sessionId, }: StartNodeSpanParams): Span;
|
|
21
|
+
/** Records the ids of the events a node emitted on its span, if it emitted any. */
|
|
22
|
+
export declare function setAssociatedEventIds(span: Span, eventIds: readonly string[]): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { TextMapGetter } from '@opentelemetry/api';
|
|
7
|
+
/** Incoming request headers, such as Node's `IncomingMessage.headers`. */
|
|
8
|
+
export type IncomingHeaders = Readonly<Record<string, string | string[] | undefined>>;
|
|
9
|
+
/**
|
|
10
|
+
* Reads incoming request headers for the propagator, matching names
|
|
11
|
+
* case-insensitively. An array value is returned as is; the W3C propagator
|
|
12
|
+
* reads its first element.
|
|
13
|
+
*/
|
|
14
|
+
export declare const INCOMING_HEADERS_GETTER: TextMapGetter<IncomingHeaders>;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the headers a `fetch(input, init)` call sends, with each injected
|
|
17
|
+
* header added unless the call already sets it.
|
|
18
|
+
*
|
|
19
|
+
* As in `fetch`, `init.headers` replaces the headers of a `Request` input
|
|
20
|
+
* when given, and the `Request` headers are kept otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export declare function addMissingHeaders(input: Parameters<typeof globalThis.fetch>[0], init: Parameters<typeof globalThis.fetch>[1], injected: Readonly<Record<string, string>>): Headers;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Attributes, Span } from '@opentelemetry/api';
|
|
7
|
+
import type { Event } from '../../../../events/event.js';
|
|
8
|
+
import type { Skill } from '../../../../skills/skill.js';
|
|
9
|
+
import type { BaseTool } from '../../../../tools/base_tool.js';
|
|
10
|
+
import type { ResolvedTelemetryConfig } from '../common/config.js';
|
|
11
|
+
/** The outcome of one tool call, as recorded on its `execute_tool` span. */
|
|
12
|
+
export type ToolCallOutcome = {
|
|
13
|
+
readonly kind: 'response';
|
|
14
|
+
readonly functionResponseEvent?: Event;
|
|
15
|
+
/** An error type the tool reported in its response instead of throwing. */
|
|
16
|
+
readonly errorType?: string;
|
|
17
|
+
} | {
|
|
18
|
+
readonly kind: 'error';
|
|
19
|
+
readonly errorType: string;
|
|
20
|
+
};
|
|
21
|
+
/** Parameters for {@link buildToolCallAttributes}. */
|
|
22
|
+
export interface ToolCallAttributesParams {
|
|
23
|
+
readonly tool: BaseTool;
|
|
24
|
+
readonly args: Record<string, unknown>;
|
|
25
|
+
readonly agentName?: string;
|
|
26
|
+
readonly outcome: ToolCallOutcome;
|
|
27
|
+
readonly config: ResolvedTelemetryConfig;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Builds the attributes of an `execute_tool` span.
|
|
31
|
+
*
|
|
32
|
+
* The call arguments and result are message content, so they are recorded
|
|
33
|
+
* only when content capture includes spans, and the result has credential
|
|
34
|
+
* secrets removed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildToolCallAttributes({ tool, args, agentName, outcome, config, }: ToolCallAttributesParams): Attributes;
|
|
37
|
+
/** Builds the attributes of an `execute_tool (merged)` span. */
|
|
38
|
+
export declare function buildMergedToolCallsAttributes(responseEventId: string): Attributes;
|
|
39
|
+
/** What a skill tool reported about the skill it worked on. */
|
|
40
|
+
export interface SkillReport {
|
|
41
|
+
/** The skill name the tool was asked for, which may not exist. */
|
|
42
|
+
readonly skillName: string;
|
|
43
|
+
/** The resource or script path, for a resource load or a script run. */
|
|
44
|
+
readonly resourceName?: string;
|
|
45
|
+
/** Whether the tool loaded the skill itself, as opposed to part of it. */
|
|
46
|
+
readonly isSkillLoad: boolean;
|
|
47
|
+
/** Whether the tool executed a skill script. */
|
|
48
|
+
readonly isSkillScript?: boolean;
|
|
49
|
+
/** The skill, once the tool has resolved it. */
|
|
50
|
+
readonly skill?: Skill;
|
|
51
|
+
}
|
|
52
|
+
/** Names an `execute_tool` span after the skill and resource it touched. */
|
|
53
|
+
export declare function buildSkillSpanName(toolName: string, report: SkillReport): string;
|
|
54
|
+
/** Builds the skill attributes of an `execute_tool` span. */
|
|
55
|
+
export declare function buildSkillAttributes(report: SkillReport): Attributes;
|
|
56
|
+
/** Records a skill on its `execute_tool` span: the span name and attributes. */
|
|
57
|
+
export declare function setSkillSpanAttributes(span: Span, toolName: string, report: SkillReport): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type Context, type Span, type Tracer } from '@opentelemetry/api';
|
|
7
|
+
/**
|
|
8
|
+
* Returns the ADK tracer from the global `TracerProvider`.
|
|
9
|
+
*
|
|
10
|
+
* Resolved on every call rather than once at import, like the logger, so the
|
|
11
|
+
* tracer carries the schema URL whichever provider the application registers
|
|
12
|
+
* and whenever it registers it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getTracer(): Tracer;
|
|
15
|
+
/**
|
|
16
|
+
* Binds an async generator to OpenTelemetry context for trace propagation.
|
|
17
|
+
*
|
|
18
|
+
* @param ctx The OpenTelemetry context to bind the generator to.
|
|
19
|
+
* @param generator The async generator to be bound to the context.
|
|
20
|
+
* @returns A new async generator that executes all operations within the provided context.
|
|
21
|
+
*/
|
|
22
|
+
export declare function bindOtelContextToAsyncGenerator<T>(ctx: Context, generator: AsyncGenerator<T, void, void>): AsyncGenerator<T, void, void>;
|
|
23
|
+
/**
|
|
24
|
+
* Records a failure on a span: the exception and an ERROR status.
|
|
25
|
+
*
|
|
26
|
+
* The status message is the error type rather than the error message, which
|
|
27
|
+
* can carry user data that the content capture setting does not gate. Only an
|
|
28
|
+
* `Error` instance is recorded as an exception; any other thrown value is
|
|
29
|
+
* recorded by its type alone.
|
|
30
|
+
*/
|
|
31
|
+
export declare function setSpanError(span: Span, error: unknown): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { type Context, type Span } from '@opentelemetry/api';
|
|
7
|
+
/** Parameters for {@link startWorkflowSpan}. */
|
|
8
|
+
export interface StartWorkflowSpanParams {
|
|
9
|
+
readonly workflowName: string;
|
|
10
|
+
readonly sessionId: string;
|
|
11
|
+
readonly nested: boolean;
|
|
12
|
+
readonly parentContext?: Context;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Starts an `invoke_workflow {workflowName}` span.
|
|
16
|
+
*
|
|
17
|
+
* A workflow started inside another workflow is marked
|
|
18
|
+
* `gen_ai.workflow.nested`; the outermost one carries no such attribute. The
|
|
19
|
+
* top span of a trace also carries `supportID` when the request supplied one.
|
|
20
|
+
*/
|
|
21
|
+
export declare function startWorkflowSpan({ workflowName, sessionId, nested, parentContext, }: StartWorkflowSpanParams): Span;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Runs `fn` in a context that continues an Agent Engine request trace.
|
|
8
|
+
*
|
|
9
|
+
* When `Google-Agent-Engine-Traceparent` holds a valid W3C traceparent and no
|
|
10
|
+
* span is active, the Agent Engine span becomes the remote parent of the
|
|
11
|
+
* spans `fn` starts. An invalid value is ignored. The `traceparent` header is
|
|
12
|
+
* recorded as the `supportID` attribute of the invocation's top span.
|
|
13
|
+
*
|
|
14
|
+
* Without either header, `fn` runs in the active context unchanged.
|
|
15
|
+
*
|
|
16
|
+
* @experimental (Experimental, subject to change)
|
|
17
|
+
*
|
|
18
|
+
* @param headers The incoming request headers, such as Node's
|
|
19
|
+
* `IncomingMessage.headers`.
|
|
20
|
+
* @param fn The request handler to run.
|
|
21
|
+
* @returns What `fn` returns.
|
|
22
|
+
*/
|
|
23
|
+
export declare function runWithAgentEngineContext<T>(headers: Readonly<Record<string, string | string[] | undefined>>, fn: () => T): T;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { OTelHooks } from './setup.js';
|
|
7
|
+
/**
|
|
8
|
+
* Hooks a server calls at the start and end of every request, so telemetry is
|
|
9
|
+
* exported while the request still holds the CPU.
|
|
10
|
+
*
|
|
11
|
+
* Neither hook throws, and {@link AgentRuntimeRequestHooks.onRequestEnd}
|
|
12
|
+
* never rejects: a telemetry failure never breaks the request.
|
|
13
|
+
*
|
|
14
|
+
* @experimental (Experimental, subject to change)
|
|
15
|
+
*/
|
|
16
|
+
export interface AgentRuntimeRequestHooks {
|
|
17
|
+
/** Call when a request arrives. */
|
|
18
|
+
onRequestStart(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Call when the handler ends the response, before the response completes.
|
|
21
|
+
* Resolves once metrics are drained and spans and logs are flushed.
|
|
22
|
+
*/
|
|
23
|
+
onRequestEnd(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Builds the request hooks that drive export for the given processors and
|
|
27
|
+
* readers on a runtime that throttles the CPU between requests.
|
|
28
|
+
*
|
|
29
|
+
* Each request start and end drives every request-driven metric reader in
|
|
30
|
+
* `otelHooks.metricReaders`. Each request end also force-flushes every span and
|
|
31
|
+
* log record processor in `otelHooks`. Other metric readers are left alone:
|
|
32
|
+
* flushing them would collect outside the request-driven reader's spacing
|
|
33
|
+
* rules.
|
|
34
|
+
*
|
|
35
|
+
* @experimental (Experimental, subject to change)
|
|
36
|
+
*
|
|
37
|
+
* @param otelHooks The processors and readers to drive, usually the result of
|
|
38
|
+
* {@link getGcpExporters}.
|
|
39
|
+
*/
|
|
40
|
+
export declare function agentRuntimeRequestHooks(otelHooks: OTelHooks): AgentRuntimeRequestHooks;
|