google-adk 1.4.0__tar.gz → 1.4.2__tar.gz
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.
- {google_adk-1.4.0 → google_adk-1.4.2}/PKG-INFO +1 -1
- google_adk-1.4.2/src/google/adk/a2a/converters/event_converter.py +382 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/a2a/converters/part_converter.py +16 -3
- google_adk-1.4.2/src/google/adk/a2a/converters/utils.py +34 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/auth_credential.py +0 -1
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/credential_manager.py +1 -5
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/exchanger/__init__.py +0 -2
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/refresher/oauth2_credential_refresher.py +2 -30
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/functions.py +1 -2
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/sessions/vertex_ai_session_service.py +18 -2
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/bigquery/bigquery_credentials.py +28 -11
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/bigquery/bigquery_tool.py +1 -1
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/bigquery/client.py +1 -1
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/bigquery/metadata_tool.py +1 -1
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/bigquery/query_tool.py +1 -1
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/mcp_tool/mcp_tool.py +2 -8
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.py +0 -1
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/version.py +1 -1
- google_adk-1.4.0/src/google/adk/auth/exchanger/service_account_credential_exchanger.py +0 -104
- {google_adk-1.4.0 → google_adk-1.4.2}/LICENSE +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/README.md +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/pyproject.toml +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/a2a/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/a2a/converters/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/active_streaming_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/base_agent.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/callback_context.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/invocation_context.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/langgraph_agent.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/live_request_queue.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/llm_agent.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/loop_agent.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/parallel_agent.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/readonly_context.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/run_config.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/sequential_agent.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/agents/transcription_entry.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/artifacts/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/artifacts/base_artifact_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/artifacts/gcs_artifact_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/artifacts/in_memory_artifact_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/auth_handler.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/auth_preprocessor.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/auth_schemes.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/auth_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/credential_service/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/credential_service/base_credential_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/credential_service/in_memory_credential_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/exchanger/base_credential_exchanger.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/exchanger/credential_exchanger_registry.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/exchanger/oauth2_credential_exchanger.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/oauth2_credential_util.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/refresher/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/refresher/base_credential_refresher.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/refresher/credential_refresher_registry.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/__main__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/agent_graph.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/browser/adk_favicon.svg +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/browser/assets/ADK-512-color.svg +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/browser/assets/audio-processor.js +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/browser/assets/config/runtime-config.json +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/browser/index.html +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/browser/main-JAAWEV7F.js +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/browser/polyfills-B6TNHZQ6.js +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/browser/styles-4VDSPQ37.css +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/cli.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/cli_create.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/cli_deploy.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/cli_eval.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/cli_tools_click.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/fast_api.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/utils/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/utils/agent_loader.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/utils/cleanup.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/utils/common.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/utils/envs.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/utils/evals.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/cli/utils/logs.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/code_executors/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/code_executors/base_code_executor.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/code_executors/built_in_code_executor.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/code_executors/code_execution_utils.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/code_executors/code_executor_context.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/code_executors/container_code_executor.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/code_executors/unsafe_local_code_executor.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/code_executors/vertex_ai_code_executor.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/errors/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/errors/not_found_error.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/_eval_set_results_manager_utils.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/_eval_sets_manager_utils.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/agent_evaluator.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/eval_case.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/eval_metrics.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/eval_result.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/eval_set.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/eval_set_results_manager.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/eval_sets_manager.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/evaluation_constants.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/evaluation_generator.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/evaluator.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/gcs_eval_set_results_manager.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/gcs_eval_sets_manager.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/local_eval_set_results_manager.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/local_eval_sets_manager.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/response_evaluator.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/evaluation/trajectory_evaluator.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/events/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/events/event.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/events/event_actions.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/examples/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/examples/base_example_provider.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/examples/example.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/examples/example_util.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/examples/vertex_ai_example_store.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/_base_llm_processor.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/_code_execution.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/_nl_planning.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/agent_transfer.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/audio_transcriber.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/auto_flow.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/base_llm_flow.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/basic.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/contents.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/identity.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/instructions.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/single_flow.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/memory/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/memory/_utils.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/memory/base_memory_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/memory/in_memory_memory_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/memory/memory_entry.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/memory/vertex_ai_rag_memory_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/models/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/models/anthropic_llm.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/models/base_llm.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/models/base_llm_connection.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/models/gemini_llm_connection.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/models/google_llm.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/models/lite_llm.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/models/llm_request.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/models/llm_response.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/models/registry.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/planners/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/planners/base_planner.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/planners/built_in_planner.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/planners/plan_re_act_planner.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/platform/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/platform/internal/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/platform/internal/thread.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/platform/thread.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/py.typed +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/runners.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/sessions/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/sessions/_session_util.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/sessions/base_session_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/sessions/database_session_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/sessions/in_memory_session_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/sessions/session.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/sessions/state.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/telemetry.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/_automatic_function_calling_util.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/_forwarding_artifact_service.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/_function_parameter_parse_util.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/_gemini_schema_util.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/_memory_entry_utils.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/agent_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/apihub_tool/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/apihub_tool/apihub_toolset.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/apihub_tool/clients/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/apihub_tool/clients/apihub_client.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/apihub_tool/clients/secret_client.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/application_integration_tool/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/application_integration_tool/application_integration_toolset.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/application_integration_tool/clients/connections_client.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/application_integration_tool/clients/integration_client.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/application_integration_tool/integration_connector_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/authenticated_function_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/base_authenticated_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/base_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/base_toolset.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/bigquery/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/bigquery/bigquery_toolset.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/bigquery/config.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/crewai_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/enterprise_search_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/example_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/exit_loop_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/function_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/get_user_choice_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/google_api_tool/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/google_api_tool/google_api_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/google_api_tool/google_api_toolset.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/google_api_tool/google_api_toolsets.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/google_api_tool/googleapi_to_openapi_converter.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/google_search_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/langchain_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/load_artifacts_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/load_memory_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/load_web_page.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/long_running_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/mcp_tool/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/mcp_tool/conversion_utils.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/mcp_tool/mcp_session_manager.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/mcp_tool/mcp_toolset.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/auth_helpers.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/base_credential_exchanger.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/common/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/common/common.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_toolset.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/preload_memory_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/retrieval/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/retrieval/base_retrieval_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/retrieval/files_retrieval.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/retrieval/llama_index_retrieval.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/retrieval/vertex_ai_rag_retrieval.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/tool_context.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/toolbox_toolset.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/transfer_to_agent_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/url_context_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/tools/vertex_ai_search_tool.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/utils/__init__.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/utils/feature_decorator.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/utils/instructions_utils.py +0 -0
- {google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/utils/variant_utils.py +0 -0
@@ -0,0 +1,382 @@
|
|
1
|
+
# Copyright 2025 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
|
17
|
+
import datetime
|
18
|
+
import logging
|
19
|
+
from typing import Any
|
20
|
+
from typing import Dict
|
21
|
+
from typing import List
|
22
|
+
from typing import Optional
|
23
|
+
import uuid
|
24
|
+
|
25
|
+
from a2a.server.events import Event as A2AEvent
|
26
|
+
from a2a.types import Artifact
|
27
|
+
from a2a.types import DataPart
|
28
|
+
from a2a.types import Message
|
29
|
+
from a2a.types import Role
|
30
|
+
from a2a.types import TaskArtifactUpdateEvent
|
31
|
+
from a2a.types import TaskState
|
32
|
+
from a2a.types import TaskStatus
|
33
|
+
from a2a.types import TaskStatusUpdateEvent
|
34
|
+
from a2a.types import TextPart
|
35
|
+
|
36
|
+
from ...agents.invocation_context import InvocationContext
|
37
|
+
from ...events.event import Event
|
38
|
+
from ...utils.feature_decorator import working_in_progress
|
39
|
+
from .part_converter import A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
|
40
|
+
from .part_converter import A2A_DATA_PART_METADATA_TYPE_KEY
|
41
|
+
from .part_converter import convert_genai_part_to_a2a_part
|
42
|
+
from .utils import _get_adk_metadata_key
|
43
|
+
|
44
|
+
# Constants
|
45
|
+
|
46
|
+
ARTIFACT_ID_SEPARATOR = "-"
|
47
|
+
DEFAULT_ERROR_MESSAGE = "An error occurred during processing"
|
48
|
+
|
49
|
+
# Logger
|
50
|
+
logger = logging.getLogger("google_adk." + __name__)
|
51
|
+
|
52
|
+
|
53
|
+
def _serialize_metadata_value(value: Any) -> str:
|
54
|
+
"""Safely serializes metadata values to string format.
|
55
|
+
|
56
|
+
Args:
|
57
|
+
value: The value to serialize.
|
58
|
+
|
59
|
+
Returns:
|
60
|
+
String representation of the value.
|
61
|
+
"""
|
62
|
+
if hasattr(value, "model_dump"):
|
63
|
+
try:
|
64
|
+
return value.model_dump(exclude_none=True, by_alias=True)
|
65
|
+
except Exception as e:
|
66
|
+
logger.warning("Failed to serialize metadata value: %s", e)
|
67
|
+
return str(value)
|
68
|
+
return str(value)
|
69
|
+
|
70
|
+
|
71
|
+
def _get_context_metadata(
|
72
|
+
event: Event, invocation_context: InvocationContext
|
73
|
+
) -> Dict[str, str]:
|
74
|
+
"""Gets the context metadata for the event.
|
75
|
+
|
76
|
+
Args:
|
77
|
+
event: The ADK event to extract metadata from.
|
78
|
+
invocation_context: The invocation context containing session information.
|
79
|
+
|
80
|
+
Returns:
|
81
|
+
A dictionary containing the context metadata.
|
82
|
+
|
83
|
+
Raises:
|
84
|
+
ValueError: If required fields are missing from event or context.
|
85
|
+
"""
|
86
|
+
if not event:
|
87
|
+
raise ValueError("Event cannot be None")
|
88
|
+
if not invocation_context:
|
89
|
+
raise ValueError("Invocation context cannot be None")
|
90
|
+
|
91
|
+
try:
|
92
|
+
metadata = {
|
93
|
+
_get_adk_metadata_key("app_name"): invocation_context.app_name,
|
94
|
+
_get_adk_metadata_key("user_id"): invocation_context.user_id,
|
95
|
+
_get_adk_metadata_key("session_id"): invocation_context.session.id,
|
96
|
+
_get_adk_metadata_key("invocation_id"): event.invocation_id,
|
97
|
+
_get_adk_metadata_key("author"): event.author,
|
98
|
+
}
|
99
|
+
|
100
|
+
# Add optional metadata fields if present
|
101
|
+
optional_fields = [
|
102
|
+
("branch", event.branch),
|
103
|
+
("grounding_metadata", event.grounding_metadata),
|
104
|
+
("custom_metadata", event.custom_metadata),
|
105
|
+
("usage_metadata", event.usage_metadata),
|
106
|
+
("error_code", event.error_code),
|
107
|
+
]
|
108
|
+
|
109
|
+
for field_name, field_value in optional_fields:
|
110
|
+
if field_value is not None:
|
111
|
+
metadata[_get_adk_metadata_key(field_name)] = _serialize_metadata_value(
|
112
|
+
field_value
|
113
|
+
)
|
114
|
+
|
115
|
+
return metadata
|
116
|
+
|
117
|
+
except Exception as e:
|
118
|
+
logger.error("Failed to create context metadata: %s", e)
|
119
|
+
raise
|
120
|
+
|
121
|
+
|
122
|
+
def _create_artifact_id(
|
123
|
+
app_name: str, user_id: str, session_id: str, filename: str, version: int
|
124
|
+
) -> str:
|
125
|
+
"""Creates a unique artifact ID.
|
126
|
+
|
127
|
+
Args:
|
128
|
+
app_name: The application name.
|
129
|
+
user_id: The user ID.
|
130
|
+
session_id: The session ID.
|
131
|
+
filename: The artifact filename.
|
132
|
+
version: The artifact version.
|
133
|
+
|
134
|
+
Returns:
|
135
|
+
A unique artifact ID string.
|
136
|
+
"""
|
137
|
+
components = [app_name, user_id, session_id, filename, str(version)]
|
138
|
+
return ARTIFACT_ID_SEPARATOR.join(components)
|
139
|
+
|
140
|
+
|
141
|
+
def _convert_artifact_to_a2a_events(
|
142
|
+
event: Event,
|
143
|
+
invocation_context: InvocationContext,
|
144
|
+
filename: str,
|
145
|
+
version: int,
|
146
|
+
) -> TaskArtifactUpdateEvent:
|
147
|
+
"""Converts a new artifact version to an A2A TaskArtifactUpdateEvent.
|
148
|
+
|
149
|
+
Args:
|
150
|
+
event: The ADK event containing the artifact information.
|
151
|
+
invocation_context: The invocation context.
|
152
|
+
filename: The name of the artifact file.
|
153
|
+
version: The version number of the artifact.
|
154
|
+
|
155
|
+
Returns:
|
156
|
+
A TaskArtifactUpdateEvent representing the artifact update.
|
157
|
+
|
158
|
+
Raises:
|
159
|
+
ValueError: If required parameters are invalid.
|
160
|
+
RuntimeError: If artifact loading fails.
|
161
|
+
"""
|
162
|
+
if not filename:
|
163
|
+
raise ValueError("Filename cannot be empty")
|
164
|
+
if version < 0:
|
165
|
+
raise ValueError("Version must be non-negative")
|
166
|
+
|
167
|
+
try:
|
168
|
+
artifact_part = invocation_context.artifact_service.load_artifact(
|
169
|
+
app_name=invocation_context.app_name,
|
170
|
+
user_id=invocation_context.user_id,
|
171
|
+
session_id=invocation_context.session.id,
|
172
|
+
filename=filename,
|
173
|
+
version=version,
|
174
|
+
)
|
175
|
+
|
176
|
+
converted_part = convert_genai_part_to_a2a_part(part=artifact_part)
|
177
|
+
if not converted_part:
|
178
|
+
raise RuntimeError(f"Failed to convert artifact part for {filename}")
|
179
|
+
|
180
|
+
artifact_id = _create_artifact_id(
|
181
|
+
invocation_context.app_name,
|
182
|
+
invocation_context.user_id,
|
183
|
+
invocation_context.session.id,
|
184
|
+
filename,
|
185
|
+
version,
|
186
|
+
)
|
187
|
+
|
188
|
+
return TaskArtifactUpdateEvent(
|
189
|
+
taskId=str(uuid.uuid4()),
|
190
|
+
append=False,
|
191
|
+
contextId=invocation_context.session.id,
|
192
|
+
lastChunk=True,
|
193
|
+
artifact=Artifact(
|
194
|
+
artifactId=artifact_id,
|
195
|
+
name=filename,
|
196
|
+
metadata={
|
197
|
+
"filename": filename,
|
198
|
+
"version": version,
|
199
|
+
},
|
200
|
+
parts=[converted_part],
|
201
|
+
),
|
202
|
+
)
|
203
|
+
except Exception as e:
|
204
|
+
logger.error(
|
205
|
+
"Failed to convert artifact for %s, version %s: %s",
|
206
|
+
filename,
|
207
|
+
version,
|
208
|
+
e,
|
209
|
+
)
|
210
|
+
raise RuntimeError(f"Artifact conversion failed: {e}") from e
|
211
|
+
|
212
|
+
|
213
|
+
def _process_long_running_tool(a2a_part, event: Event) -> None:
|
214
|
+
"""Processes long-running tool metadata for an A2A part.
|
215
|
+
|
216
|
+
Args:
|
217
|
+
a2a_part: The A2A part to potentially mark as long-running.
|
218
|
+
event: The ADK event containing long-running tool information.
|
219
|
+
"""
|
220
|
+
if (
|
221
|
+
isinstance(a2a_part.root, DataPart)
|
222
|
+
and event.long_running_tool_ids
|
223
|
+
and a2a_part.root.metadata.get(
|
224
|
+
_get_adk_metadata_key(A2A_DATA_PART_METADATA_TYPE_KEY)
|
225
|
+
)
|
226
|
+
== A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
|
227
|
+
and a2a_part.root.metadata.get("id") in event.long_running_tool_ids
|
228
|
+
):
|
229
|
+
a2a_part.root.metadata[_get_adk_metadata_key("is_long_running")] = True
|
230
|
+
|
231
|
+
|
232
|
+
@working_in_progress
|
233
|
+
def convert_event_to_a2a_status_message(
|
234
|
+
event: Event, invocation_context: InvocationContext
|
235
|
+
) -> Optional[Message]:
|
236
|
+
"""Converts an ADK event to an A2A message.
|
237
|
+
|
238
|
+
Args:
|
239
|
+
event: The ADK event to convert.
|
240
|
+
invocation_context: The invocation context.
|
241
|
+
|
242
|
+
Returns:
|
243
|
+
An A2A Message if the event has content, None otherwise.
|
244
|
+
|
245
|
+
Raises:
|
246
|
+
ValueError: If required parameters are invalid.
|
247
|
+
"""
|
248
|
+
if not event:
|
249
|
+
raise ValueError("Event cannot be None")
|
250
|
+
if not invocation_context:
|
251
|
+
raise ValueError("Invocation context cannot be None")
|
252
|
+
|
253
|
+
if not event.content or not event.content.parts:
|
254
|
+
return None
|
255
|
+
|
256
|
+
try:
|
257
|
+
a2a_parts = []
|
258
|
+
for part in event.content.parts:
|
259
|
+
a2a_part = convert_genai_part_to_a2a_part(part)
|
260
|
+
if a2a_part:
|
261
|
+
a2a_parts.append(a2a_part)
|
262
|
+
_process_long_running_tool(a2a_part, event)
|
263
|
+
|
264
|
+
if a2a_parts:
|
265
|
+
return Message(
|
266
|
+
messageId=str(uuid.uuid4()), role=Role.agent, parts=a2a_parts
|
267
|
+
)
|
268
|
+
|
269
|
+
except Exception as e:
|
270
|
+
logger.error("Failed to convert event to status message: %s", e)
|
271
|
+
raise
|
272
|
+
|
273
|
+
return None
|
274
|
+
|
275
|
+
|
276
|
+
def _create_error_status_event(
|
277
|
+
event: Event, invocation_context: InvocationContext
|
278
|
+
) -> TaskStatusUpdateEvent:
|
279
|
+
"""Creates a TaskStatusUpdateEvent for error scenarios.
|
280
|
+
|
281
|
+
Args:
|
282
|
+
event: The ADK event containing error information.
|
283
|
+
invocation_context: The invocation context.
|
284
|
+
|
285
|
+
Returns:
|
286
|
+
A TaskStatusUpdateEvent with FAILED state.
|
287
|
+
"""
|
288
|
+
error_message = getattr(event, "error_message", None) or DEFAULT_ERROR_MESSAGE
|
289
|
+
|
290
|
+
return TaskStatusUpdateEvent(
|
291
|
+
taskId=str(uuid.uuid4()),
|
292
|
+
contextId=invocation_context.session.id,
|
293
|
+
final=False,
|
294
|
+
metadata=_get_context_metadata(event, invocation_context),
|
295
|
+
status=TaskStatus(
|
296
|
+
state=TaskState.failed,
|
297
|
+
message=Message(
|
298
|
+
messageId=str(uuid.uuid4()),
|
299
|
+
role=Role.agent,
|
300
|
+
parts=[TextPart(text=error_message)],
|
301
|
+
),
|
302
|
+
timestamp=datetime.datetime.now().isoformat(),
|
303
|
+
),
|
304
|
+
)
|
305
|
+
|
306
|
+
|
307
|
+
def _create_running_status_event(
|
308
|
+
message: Message, invocation_context: InvocationContext, event: Event
|
309
|
+
) -> TaskStatusUpdateEvent:
|
310
|
+
"""Creates a TaskStatusUpdateEvent for running scenarios.
|
311
|
+
|
312
|
+
Args:
|
313
|
+
message: The A2A message to include.
|
314
|
+
invocation_context: The invocation context.
|
315
|
+
event: The ADK event.
|
316
|
+
|
317
|
+
Returns:
|
318
|
+
A TaskStatusUpdateEvent with RUNNING state.
|
319
|
+
"""
|
320
|
+
return TaskStatusUpdateEvent(
|
321
|
+
taskId=str(uuid.uuid4()),
|
322
|
+
contextId=invocation_context.session.id,
|
323
|
+
final=False,
|
324
|
+
status=TaskStatus(
|
325
|
+
state=TaskState.working,
|
326
|
+
message=message,
|
327
|
+
timestamp=datetime.datetime.now().isoformat(),
|
328
|
+
),
|
329
|
+
metadata=_get_context_metadata(event, invocation_context),
|
330
|
+
)
|
331
|
+
|
332
|
+
|
333
|
+
@working_in_progress
|
334
|
+
def convert_event_to_a2a_events(
|
335
|
+
event: Event, invocation_context: InvocationContext
|
336
|
+
) -> List[A2AEvent]:
|
337
|
+
"""Converts a GenAI event to a list of A2A events.
|
338
|
+
|
339
|
+
Args:
|
340
|
+
event: The ADK event to convert.
|
341
|
+
invocation_context: The invocation context.
|
342
|
+
|
343
|
+
Returns:
|
344
|
+
A list of A2A events representing the converted ADK event.
|
345
|
+
|
346
|
+
Raises:
|
347
|
+
ValueError: If required parameters are invalid.
|
348
|
+
"""
|
349
|
+
if not event:
|
350
|
+
raise ValueError("Event cannot be None")
|
351
|
+
if not invocation_context:
|
352
|
+
raise ValueError("Invocation context cannot be None")
|
353
|
+
|
354
|
+
a2a_events = []
|
355
|
+
|
356
|
+
try:
|
357
|
+
# Handle artifact deltas
|
358
|
+
if event.actions.artifact_delta:
|
359
|
+
for filename, version in event.actions.artifact_delta.items():
|
360
|
+
artifact_event = _convert_artifact_to_a2a_events(
|
361
|
+
event, invocation_context, filename, version
|
362
|
+
)
|
363
|
+
a2a_events.append(artifact_event)
|
364
|
+
|
365
|
+
# Handle error scenarios
|
366
|
+
if event.error_code:
|
367
|
+
error_event = _create_error_status_event(event, invocation_context)
|
368
|
+
a2a_events.append(error_event)
|
369
|
+
|
370
|
+
# Handle regular message content
|
371
|
+
message = convert_event_to_a2a_status_message(event, invocation_context)
|
372
|
+
if message:
|
373
|
+
running_event = _create_running_status_event(
|
374
|
+
message, invocation_context, event
|
375
|
+
)
|
376
|
+
a2a_events.append(running_event)
|
377
|
+
|
378
|
+
except Exception as e:
|
379
|
+
logger.error("Failed to convert event to A2A events: %s", e)
|
380
|
+
raise
|
381
|
+
|
382
|
+
return a2a_events
|
@@ -20,9 +20,22 @@ from __future__ import annotations
|
|
20
20
|
|
21
21
|
import json
|
22
22
|
import logging
|
23
|
+
import sys
|
23
24
|
from typing import Optional
|
24
25
|
|
25
|
-
from
|
26
|
+
from .utils import _get_adk_metadata_key
|
27
|
+
|
28
|
+
try:
|
29
|
+
from a2a import types as a2a_types
|
30
|
+
except ImportError as e:
|
31
|
+
if sys.version_info < (3, 10):
|
32
|
+
raise ImportError(
|
33
|
+
'A2A Tool requires Python 3.10 or above. Please upgrade your Python'
|
34
|
+
' version.'
|
35
|
+
) from e
|
36
|
+
else:
|
37
|
+
raise e
|
38
|
+
|
26
39
|
from google.genai import types as genai_types
|
27
40
|
|
28
41
|
from ...utils.feature_decorator import working_in_progress
|
@@ -73,7 +86,7 @@ def convert_a2a_part_to_genai_part(
|
|
73
86
|
# logic accordinlgy
|
74
87
|
if part.metadata and A2A_DATA_PART_METADATA_TYPE_KEY in part.metadata:
|
75
88
|
if (
|
76
|
-
part.metadata[A2A_DATA_PART_METADATA_TYPE_KEY]
|
89
|
+
part.metadata[_get_adk_metadata_key(A2A_DATA_PART_METADATA_TYPE_KEY)]
|
77
90
|
== A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
|
78
91
|
):
|
79
92
|
return genai_types.Part(
|
@@ -82,7 +95,7 @@ def convert_a2a_part_to_genai_part(
|
|
82
95
|
)
|
83
96
|
)
|
84
97
|
if (
|
85
|
-
part.metadata[A2A_DATA_PART_METADATA_TYPE_KEY]
|
98
|
+
part.metadata[_get_adk_metadata_key(A2A_DATA_PART_METADATA_TYPE_KEY)]
|
86
99
|
== A2A_DATA_PART_METADATA_TYPE_FUNCTION_RESPONSE
|
87
100
|
):
|
88
101
|
return genai_types.Part(
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Copyright 2025 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
|
17
|
+
ADK_METADATA_KEY_PREFIX = "adk_"
|
18
|
+
|
19
|
+
|
20
|
+
def _get_adk_metadata_key(key: str) -> str:
|
21
|
+
"""Gets the A2A event metadata key for the given key.
|
22
|
+
|
23
|
+
Args:
|
24
|
+
key: The metadata key to prefix.
|
25
|
+
|
26
|
+
Returns:
|
27
|
+
The prefixed metadata key.
|
28
|
+
|
29
|
+
Raises:
|
30
|
+
ValueError: If key is empty or None.
|
31
|
+
"""
|
32
|
+
if not key:
|
33
|
+
raise ValueError("Metadata key cannot be empty or None")
|
34
|
+
return f"{ADK_METADATA_KEY_PREFIX}{key}"
|
@@ -76,11 +76,7 @@ class CredentialManager:
|
|
76
76
|
self._refresher_registry = CredentialRefresherRegistry()
|
77
77
|
|
78
78
|
# Register default exchangers and refreshers
|
79
|
-
|
80
|
-
|
81
|
-
self._exchanger_registry.register(
|
82
|
-
AuthCredentialTypes.SERVICE_ACCOUNT, ServiceAccountCredentialExchanger()
|
83
|
-
)
|
79
|
+
# TODO: support service account credential exchanger
|
84
80
|
from .refresher.oauth2_credential_refresher import OAuth2CredentialRefresher
|
85
81
|
|
86
82
|
oauth2_refresher = OAuth2CredentialRefresher()
|
@@ -15,9 +15,7 @@
|
|
15
15
|
"""Credential exchanger module."""
|
16
16
|
|
17
17
|
from .base_credential_exchanger import BaseCredentialExchanger
|
18
|
-
from .service_account_credential_exchanger import ServiceAccountCredentialExchanger
|
19
18
|
|
20
19
|
__all__ = [
|
21
20
|
"BaseCredentialExchanger",
|
22
|
-
"ServiceAccountCredentialExchanger",
|
23
21
|
]
|
{google_adk-1.4.0 → google_adk-1.4.2}/src/google/adk/auth/refresher/oauth2_credential_refresher.py
RENAMED
@@ -60,27 +60,12 @@ class OAuth2CredentialRefresher(BaseCredentialRefresher):
|
|
60
60
|
Returns:
|
61
61
|
True if the credential needs to be refreshed, False otherwise.
|
62
62
|
"""
|
63
|
-
# Handle Google OAuth2 credentials (from service account exchange)
|
64
|
-
if auth_credential.google_oauth2_json:
|
65
|
-
try:
|
66
|
-
google_credential = Credentials.from_authorized_user_info(
|
67
|
-
json.loads(auth_credential.google_oauth2_json)
|
68
|
-
)
|
69
|
-
return google_credential.expired and bool(
|
70
|
-
google_credential.refresh_token
|
71
|
-
)
|
72
|
-
except Exception as e:
|
73
|
-
logger.warning("Failed to parse Google OAuth2 JSON credential: %s", e)
|
74
|
-
return False
|
75
63
|
|
76
64
|
# Handle regular OAuth2 credentials
|
77
|
-
|
65
|
+
if auth_credential.oauth2:
|
78
66
|
if not AUTHLIB_AVIALABLE:
|
79
67
|
return False
|
80
68
|
|
81
|
-
if not auth_credential.oauth2:
|
82
|
-
return False
|
83
|
-
|
84
69
|
return OAuth2Token({
|
85
70
|
"expires_at": auth_credential.oauth2.expires_at,
|
86
71
|
"expires_in": auth_credential.oauth2.expires_in,
|
@@ -105,22 +90,9 @@ class OAuth2CredentialRefresher(BaseCredentialRefresher):
|
|
105
90
|
The refreshed credential.
|
106
91
|
|
107
92
|
"""
|
108
|
-
# Handle Google OAuth2 credentials (from service account exchange)
|
109
|
-
if auth_credential.google_oauth2_json:
|
110
|
-
try:
|
111
|
-
google_credential = Credentials.from_authorized_user_info(
|
112
|
-
json.loads(auth_credential.google_oauth2_json)
|
113
|
-
)
|
114
|
-
if google_credential.expired and google_credential.refresh_token:
|
115
|
-
google_credential.refresh(Request())
|
116
|
-
auth_credential.google_oauth2_json = google_credential.to_json()
|
117
|
-
logger.info("Successfully refreshed Google OAuth2 JSON credential")
|
118
|
-
except Exception as e:
|
119
|
-
# TODO reconsider whether we should raise error when refresh failed.
|
120
|
-
logger.error("Failed to refresh Google OAuth2 JSON credential: %s", e)
|
121
93
|
|
122
94
|
# Handle regular OAuth2 credentials
|
123
|
-
|
95
|
+
if auth_credential.oauth2 and auth_scheme:
|
124
96
|
if not AUTHLIB_AVIALABLE:
|
125
97
|
return auth_credential
|
126
98
|
|
@@ -288,8 +288,7 @@ async def handle_function_calls_live(
|
|
288
288
|
trace_tool_call(
|
289
289
|
tool=tool,
|
290
290
|
args=function_args,
|
291
|
-
|
292
|
-
function_response=function_response,
|
291
|
+
function_response_event=function_response_event,
|
293
292
|
)
|
294
293
|
function_response_events.append(function_response_event)
|
295
294
|
|
@@ -14,6 +14,7 @@
|
|
14
14
|
from __future__ import annotations
|
15
15
|
|
16
16
|
import asyncio
|
17
|
+
import json
|
17
18
|
import logging
|
18
19
|
import re
|
19
20
|
from typing import Any
|
@@ -87,6 +88,7 @@ class VertexAiSessionService(BaseSessionService):
|
|
87
88
|
path=f'reasoningEngines/{reasoning_engine_id}/sessions',
|
88
89
|
request_dict=session_json_dict,
|
89
90
|
)
|
91
|
+
api_response = _convert_api_response(api_response)
|
90
92
|
logger.info(f'Create Session response {api_response}')
|
91
93
|
|
92
94
|
session_id = api_response['name'].split('/')[-3]
|
@@ -100,6 +102,7 @@ class VertexAiSessionService(BaseSessionService):
|
|
100
102
|
path=f'operations/{operation_id}',
|
101
103
|
request_dict={},
|
102
104
|
)
|
105
|
+
lro_response = _convert_api_response(lro_response)
|
103
106
|
|
104
107
|
if lro_response.get('done', None):
|
105
108
|
break
|
@@ -118,6 +121,7 @@ class VertexAiSessionService(BaseSessionService):
|
|
118
121
|
path=f'reasoningEngines/{reasoning_engine_id}/sessions/{session_id}',
|
119
122
|
request_dict={},
|
120
123
|
)
|
124
|
+
get_session_api_response = _convert_api_response(get_session_api_response)
|
121
125
|
|
122
126
|
update_timestamp = isoparse(
|
123
127
|
get_session_api_response['updateTime']
|
@@ -149,6 +153,7 @@ class VertexAiSessionService(BaseSessionService):
|
|
149
153
|
path=f'reasoningEngines/{reasoning_engine_id}/sessions/{session_id}',
|
150
154
|
request_dict={},
|
151
155
|
)
|
156
|
+
get_session_api_response = _convert_api_response(get_session_api_response)
|
152
157
|
|
153
158
|
session_id = get_session_api_response['name'].split('/')[-1]
|
154
159
|
update_timestamp = isoparse(
|
@@ -167,9 +172,12 @@ class VertexAiSessionService(BaseSessionService):
|
|
167
172
|
path=f'reasoningEngines/{reasoning_engine_id}/sessions/{session_id}/events',
|
168
173
|
request_dict={},
|
169
174
|
)
|
175
|
+
list_events_api_response = _convert_api_response(list_events_api_response)
|
170
176
|
|
171
177
|
# Handles empty response case
|
172
|
-
if list_events_api_response.get(
|
178
|
+
if not list_events_api_response or list_events_api_response.get(
|
179
|
+
'httpHeaders', None
|
180
|
+
):
|
173
181
|
return session
|
174
182
|
|
175
183
|
session.events += [
|
@@ -226,9 +234,10 @@ class VertexAiSessionService(BaseSessionService):
|
|
226
234
|
path=path,
|
227
235
|
request_dict={},
|
228
236
|
)
|
237
|
+
api_response = _convert_api_response(api_response)
|
229
238
|
|
230
239
|
# Handles empty response case
|
231
|
-
if api_response.get('httpHeaders', None):
|
240
|
+
if not api_response or api_response.get('httpHeaders', None):
|
232
241
|
return ListSessionsResponse()
|
233
242
|
|
234
243
|
sessions = []
|
@@ -303,6 +312,13 @@ class VertexAiSessionService(BaseSessionService):
|
|
303
312
|
return client._api_client
|
304
313
|
|
305
314
|
|
315
|
+
def _convert_api_response(api_response):
|
316
|
+
"""Converts the API response to a JSON object based on the type."""
|
317
|
+
if hasattr(api_response, 'body'):
|
318
|
+
return json.loads(api_response.body)
|
319
|
+
return api_response
|
320
|
+
|
321
|
+
|
306
322
|
def _convert_event_to_json(event: Event) -> Dict[str, Any]:
|
307
323
|
metadata_json = {
|
308
324
|
'partial': event.partial,
|