google-adk 1.4.1__tar.gz → 1.5.0__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.1 → google_adk-1.5.0}/PKG-INFO +6 -5
- {google_adk-1.4.1 → google_adk-1.5.0}/README.md +1 -1
- {google_adk-1.4.1 → google_adk-1.5.0}/pyproject.toml +4 -4
- google_adk-1.5.0/src/google/adk/a2a/converters/event_converter.py +382 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/a2a/converters/part_converter.py +4 -2
- google_adk-1.5.0/src/google/adk/a2a/converters/request_converter.py +90 -0
- google_adk-1.5.0/src/google/adk/a2a/converters/utils.py +71 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/llm_agent.py +5 -3
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/artifacts/gcs_artifact_service.py +3 -2
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/auth_tool.py +2 -2
- google_adk-1.5.0/src/google/adk/auth/credential_service/session_state_credential_service.py +83 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/cli_deploy.py +9 -2
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/cli_tools_click.py +110 -52
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/fast_api.py +26 -2
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/utils/evals.py +53 -0
- google_adk-1.5.0/src/google/adk/evaluation/final_response_match_v1.py +110 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/gcs_eval_sets_manager.py +8 -5
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/response_evaluator.py +12 -1
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/events/event.py +5 -5
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/contents.py +49 -4
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/functions.py +32 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/memory/__init__.py +3 -1
- google_adk-1.5.0/src/google/adk/memory/vertex_ai_memory_bank_service.py +150 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/models/lite_llm.py +9 -1
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/runners.py +10 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/sessions/vertex_ai_session_service.py +70 -19
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/telemetry.py +10 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/bigquery/bigquery_credentials.py +28 -11
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/bigquery/bigquery_tool.py +1 -1
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/bigquery/client.py +1 -1
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/bigquery/metadata_tool.py +1 -1
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/bigquery/query_tool.py +1 -1
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/version.py +1 -1
- {google_adk-1.4.1 → google_adk-1.5.0}/LICENSE +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/a2a/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/a2a/converters/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/active_streaming_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/base_agent.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/callback_context.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/invocation_context.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/langgraph_agent.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/live_request_queue.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/loop_agent.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/parallel_agent.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/readonly_context.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/run_config.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/sequential_agent.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/agents/transcription_entry.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/artifacts/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/artifacts/base_artifact_service.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/artifacts/in_memory_artifact_service.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/auth_credential.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/auth_handler.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/auth_preprocessor.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/auth_schemes.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/credential_manager.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/credential_service/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/credential_service/base_credential_service.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/credential_service/in_memory_credential_service.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/exchanger/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/exchanger/base_credential_exchanger.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/exchanger/credential_exchanger_registry.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/exchanger/oauth2_credential_exchanger.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/oauth2_credential_util.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/refresher/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/refresher/base_credential_refresher.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/refresher/credential_refresher_registry.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/auth/refresher/oauth2_credential_refresher.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/__main__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/agent_graph.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/browser/adk_favicon.svg +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/browser/assets/ADK-512-color.svg +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/browser/assets/audio-processor.js +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/browser/assets/config/runtime-config.json +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/browser/index.html +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/browser/main-JAAWEV7F.js +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/browser/polyfills-B6TNHZQ6.js +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/browser/styles-4VDSPQ37.css +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/cli.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/cli_create.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/cli_eval.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/utils/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/utils/agent_loader.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/utils/cleanup.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/utils/common.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/utils/envs.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/cli/utils/logs.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/code_executors/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/code_executors/base_code_executor.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/code_executors/built_in_code_executor.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/code_executors/code_execution_utils.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/code_executors/code_executor_context.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/code_executors/container_code_executor.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/code_executors/unsafe_local_code_executor.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/code_executors/vertex_ai_code_executor.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/errors/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/errors/not_found_error.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/_eval_set_results_manager_utils.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/_eval_sets_manager_utils.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/agent_evaluator.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/eval_case.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/eval_metrics.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/eval_result.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/eval_set.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/eval_set_results_manager.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/eval_sets_manager.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/evaluation_constants.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/evaluation_generator.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/evaluator.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/gcs_eval_set_results_manager.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/local_eval_set_results_manager.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/local_eval_sets_manager.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/evaluation/trajectory_evaluator.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/events/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/events/event_actions.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/examples/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/examples/base_example_provider.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/examples/example.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/examples/example_util.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/examples/vertex_ai_example_store.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/_base_llm_processor.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/_code_execution.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/_nl_planning.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/agent_transfer.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/audio_transcriber.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/auto_flow.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/base_llm_flow.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/basic.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/identity.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/instructions.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/flows/llm_flows/single_flow.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/memory/_utils.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/memory/base_memory_service.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/memory/in_memory_memory_service.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/memory/memory_entry.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/memory/vertex_ai_rag_memory_service.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/models/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/models/anthropic_llm.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/models/base_llm.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/models/base_llm_connection.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/models/gemini_llm_connection.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/models/google_llm.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/models/llm_request.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/models/llm_response.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/models/registry.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/planners/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/planners/base_planner.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/planners/built_in_planner.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/planners/plan_re_act_planner.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/platform/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/platform/internal/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/platform/internal/thread.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/platform/thread.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/py.typed +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/sessions/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/sessions/_session_util.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/sessions/base_session_service.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/sessions/database_session_service.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/sessions/in_memory_session_service.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/sessions/session.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/sessions/state.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/_automatic_function_calling_util.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/_forwarding_artifact_service.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/_function_parameter_parse_util.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/_gemini_schema_util.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/_memory_entry_utils.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/agent_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/apihub_tool/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/apihub_tool/apihub_toolset.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/apihub_tool/clients/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/apihub_tool/clients/apihub_client.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/apihub_tool/clients/secret_client.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/application_integration_tool/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/application_integration_tool/application_integration_toolset.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/application_integration_tool/clients/connections_client.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/application_integration_tool/clients/integration_client.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/application_integration_tool/integration_connector_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/authenticated_function_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/base_authenticated_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/base_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/base_toolset.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/bigquery/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/bigquery/bigquery_toolset.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/bigquery/config.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/crewai_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/enterprise_search_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/example_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/exit_loop_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/function_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/get_user_choice_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/google_api_tool/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/google_api_tool/google_api_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/google_api_tool/google_api_toolset.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/google_api_tool/google_api_toolsets.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/google_api_tool/googleapi_to_openapi_converter.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/google_search_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/langchain_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/load_artifacts_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/load_memory_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/load_web_page.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/long_running_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/mcp_tool/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/mcp_tool/conversion_utils.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/mcp_tool/mcp_session_manager.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/mcp_tool/mcp_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/mcp_tool/mcp_toolset.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/auth/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/auth/auth_helpers.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/base_credential_exchanger.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/common/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/common/common.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_toolset.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/preload_memory_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/retrieval/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/retrieval/base_retrieval_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/retrieval/files_retrieval.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/retrieval/llama_index_retrieval.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/retrieval/vertex_ai_rag_retrieval.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/tool_context.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/toolbox_toolset.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/transfer_to_agent_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/url_context_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/tools/vertex_ai_search_tool.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/utils/__init__.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/utils/feature_decorator.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/utils/instructions_utils.py +0 -0
- {google_adk-1.4.1 → google_adk-1.5.0}/src/google/adk/utils/variant_utils.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: google-adk
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.5.0
|
4
4
|
Summary: Agent Development Kit
|
5
5
|
Author-email: Google LLC <googleapis-packages@google.com>
|
6
6
|
Requires-Python: >=3.9
|
@@ -19,6 +19,7 @@ Classifier: Operating System :: OS Independent
|
|
19
19
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
20
20
|
Classifier: License :: OSI Approved :: Apache Software License
|
21
21
|
License-File: LICENSE
|
22
|
+
Requires-Dist: PyYAML>=6.0.2
|
22
23
|
Requires-Dist: anyio>=4.9.0;python_version>='3.10'
|
23
24
|
Requires-Dist: authlib>=1.5.1
|
24
25
|
Requires-Dist: click>=8.1.8
|
@@ -28,7 +29,7 @@ Requires-Dist: google-cloud-aiplatform[agent-engines]>=1.95.1
|
|
28
29
|
Requires-Dist: google-cloud-secret-manager>=2.22.0
|
29
30
|
Requires-Dist: google-cloud-speech>=2.30.0
|
30
31
|
Requires-Dist: google-cloud-storage>=2.18.0, <3.0.0
|
31
|
-
Requires-Dist: google-genai>=1.
|
32
|
+
Requires-Dist: google-genai>=1.21.1
|
32
33
|
Requires-Dist: graphviz>=0.20.2
|
33
34
|
Requires-Dist: mcp>=1.8.0;python_version>='3.10'
|
34
35
|
Requires-Dist: opentelemetry-api>=1.31.0
|
@@ -37,7 +38,6 @@ Requires-Dist: opentelemetry-sdk>=1.31.0
|
|
37
38
|
Requires-Dist: pydantic>=2.0, <3.0.0
|
38
39
|
Requires-Dist: python-dateutil>=2.9.0.post0
|
39
40
|
Requires-Dist: python-dotenv>=1.0.0
|
40
|
-
Requires-Dist: PyYAML>=6.0.2
|
41
41
|
Requires-Dist: requests>=2.32.4
|
42
42
|
Requires-Dist: sqlalchemy>=2.0
|
43
43
|
Requires-Dist: starlette>=0.46.2
|
@@ -48,9 +48,9 @@ Requires-Dist: websockets>=15.0.1
|
|
48
48
|
Requires-Dist: a2a-sdk>=0.2.7 ; extra == "a2a" and (python_version>='3.10')
|
49
49
|
Requires-Dist: flit>=3.10.0 ; extra == "dev"
|
50
50
|
Requires-Dist: isort>=6.0.0 ; extra == "dev"
|
51
|
+
Requires-Dist: mypy>=1.15.0 ; extra == "dev"
|
51
52
|
Requires-Dist: pyink>=24.10.0 ; extra == "dev"
|
52
53
|
Requires-Dist: pylint>=2.6.0 ; extra == "dev"
|
53
|
-
Requires-Dist: mypy>=1.15.0 ; extra == "dev"
|
54
54
|
Requires-Dist: autodoc_pydantic ; extra == "docs"
|
55
55
|
Requires-Dist: furo ; extra == "docs"
|
56
56
|
Requires-Dist: myst-parser ; extra == "docs"
|
@@ -60,6 +60,7 @@ Requires-Dist: sphinx-rtd-theme ; extra == "docs"
|
|
60
60
|
Requires-Dist: google-cloud-aiplatform[evaluation]>=1.87.0 ; extra == "eval"
|
61
61
|
Requires-Dist: pandas>=2.2.3 ; extra == "eval"
|
62
62
|
Requires-Dist: tabulate>=0.9.0 ; extra == "eval"
|
63
|
+
Requires-Dist: rouge-score>=0.1.2 ; extra == "eval"
|
63
64
|
Requires-Dist: anthropic>=0.43.0 ; extra == "extensions"
|
64
65
|
Requires-Dist: beautifulsoup4>=3.2.2 ; extra == "extensions"
|
65
66
|
Requires-Dist: crewai[tools] ; extra == "extensions" and (python_version>='3.10')
|
@@ -226,7 +227,7 @@ adk eval \
|
|
226
227
|
## 🤝 Contributing
|
227
228
|
|
228
229
|
We welcome contributions from the community! Whether it's bug reports, feature requests, documentation improvements, or code contributions, please see our
|
229
|
-
- [General contribution guideline and flow](https://google.github.io/adk-docs/contributing-guide
|
230
|
+
- [General contribution guideline and flow](https://google.github.io/adk-docs/contributing-guide/).
|
230
231
|
- Then if you want to contribute code, please read [Code Contributing Guidelines](./CONTRIBUTING.md) to get started.
|
231
232
|
|
232
233
|
## 📄 License
|
@@ -135,7 +135,7 @@ adk eval \
|
|
135
135
|
## 🤝 Contributing
|
136
136
|
|
137
137
|
We welcome contributions from the community! Whether it's bug reports, feature requests, documentation improvements, or code contributions, please see our
|
138
|
-
- [General contribution guideline and flow](https://google.github.io/adk-docs/contributing-guide
|
138
|
+
- [General contribution guideline and flow](https://google.github.io/adk-docs/contributing-guide/).
|
139
139
|
- Then if you want to contribute code, please read [Code Contributing Guidelines](./CONTRIBUTING.md) to get started.
|
140
140
|
|
141
141
|
## 📄 License
|
@@ -25,6 +25,7 @@ classifiers = [ # List of https://pypi.org/classifiers/
|
|
25
25
|
]
|
26
26
|
dependencies = [
|
27
27
|
# go/keep-sorted start
|
28
|
+
"PyYAML>=6.0.2", # For APIHubToolset.
|
28
29
|
"anyio>=4.9.0;python_version>='3.10'", # For MCP Session Manager
|
29
30
|
"authlib>=1.5.1", # For RestAPI Tool
|
30
31
|
"click>=8.1.8", # For CLI tools
|
@@ -34,7 +35,7 @@ dependencies = [
|
|
34
35
|
"google-cloud-secret-manager>=2.22.0", # Fetching secrets in RestAPI Tool
|
35
36
|
"google-cloud-speech>=2.30.0", # For Audio Transcription
|
36
37
|
"google-cloud-storage>=2.18.0, <3.0.0", # For GCS Artifact service
|
37
|
-
"google-genai>=1.
|
38
|
+
"google-genai>=1.21.1", # Google GenAI SDK
|
38
39
|
"graphviz>=0.20.2", # Graphviz for graph rendering
|
39
40
|
"mcp>=1.8.0;python_version>='3.10'", # For MCP Toolset
|
40
41
|
"opentelemetry-api>=1.31.0", # OpenTelemetry
|
@@ -43,7 +44,6 @@ dependencies = [
|
|
43
44
|
"pydantic>=2.0, <3.0.0", # For data validation/models
|
44
45
|
"python-dateutil>=2.9.0.post0", # For Vertext AI Session Service
|
45
46
|
"python-dotenv>=1.0.0", # To manage environment variables
|
46
|
-
"PyYAML>=6.0.2", # For APIHubToolset.
|
47
47
|
"requests>=2.32.4",
|
48
48
|
"sqlalchemy>=2.0", # SQL database ORM
|
49
49
|
"starlette>=0.46.2", # For FastAPI CLI
|
@@ -70,9 +70,9 @@ dev = [
|
|
70
70
|
# go/keep-sorted start
|
71
71
|
"flit>=3.10.0",
|
72
72
|
"isort>=6.0.0",
|
73
|
+
"mypy>=1.15.0",
|
73
74
|
"pyink>=24.10.0",
|
74
75
|
"pylint>=2.6.0",
|
75
|
-
"mypy>=1.15.0",
|
76
76
|
# go/keep-sorted end
|
77
77
|
]
|
78
78
|
|
@@ -87,6 +87,7 @@ eval = [
|
|
87
87
|
"google-cloud-aiplatform[evaluation]>=1.87.0",
|
88
88
|
"pandas>=2.2.3",
|
89
89
|
"tabulate>=0.9.0",
|
90
|
+
"rouge-score>=0.1.2",
|
90
91
|
# go/keep-sorted end
|
91
92
|
]
|
92
93
|
|
@@ -97,7 +98,6 @@ test = [
|
|
97
98
|
"langgraph>=0.2.60", # For LangGraphAgent
|
98
99
|
"litellm>=1.71.2", # For LiteLLM tests
|
99
100
|
"llama-index-readers-file>=0.4.0", # For retrieval tests
|
100
|
-
|
101
101
|
"pytest-asyncio>=0.25.0",
|
102
102
|
"pytest-mock>=3.14.0",
|
103
103
|
"pytest-xdist>=3.6.1",
|
@@ -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
|
@@ -23,6 +23,8 @@ import logging
|
|
23
23
|
import sys
|
24
24
|
from typing import Optional
|
25
25
|
|
26
|
+
from .utils import _get_adk_metadata_key
|
27
|
+
|
26
28
|
try:
|
27
29
|
from a2a import types as a2a_types
|
28
30
|
except ImportError as e:
|
@@ -84,7 +86,7 @@ def convert_a2a_part_to_genai_part(
|
|
84
86
|
# logic accordinlgy
|
85
87
|
if part.metadata and A2A_DATA_PART_METADATA_TYPE_KEY in part.metadata:
|
86
88
|
if (
|
87
|
-
part.metadata[A2A_DATA_PART_METADATA_TYPE_KEY]
|
89
|
+
part.metadata[_get_adk_metadata_key(A2A_DATA_PART_METADATA_TYPE_KEY)]
|
88
90
|
== A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
|
89
91
|
):
|
90
92
|
return genai_types.Part(
|
@@ -93,7 +95,7 @@ def convert_a2a_part_to_genai_part(
|
|
93
95
|
)
|
94
96
|
)
|
95
97
|
if (
|
96
|
-
part.metadata[A2A_DATA_PART_METADATA_TYPE_KEY]
|
98
|
+
part.metadata[_get_adk_metadata_key(A2A_DATA_PART_METADATA_TYPE_KEY)]
|
97
99
|
== A2A_DATA_PART_METADATA_TYPE_FUNCTION_RESPONSE
|
98
100
|
):
|
99
101
|
return genai_types.Part(
|
@@ -0,0 +1,90 @@
|
|
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 sys
|
18
|
+
from typing import Any
|
19
|
+
|
20
|
+
try:
|
21
|
+
from a2a.server.agent_execution import RequestContext
|
22
|
+
except ImportError as e:
|
23
|
+
if sys.version_info < (3, 10):
|
24
|
+
raise ImportError(
|
25
|
+
'A2A Tool requires Python 3.10 or above. Please upgrade your Python'
|
26
|
+
' version.'
|
27
|
+
) from e
|
28
|
+
else:
|
29
|
+
raise e
|
30
|
+
|
31
|
+
from google.genai import types as genai_types
|
32
|
+
|
33
|
+
from ...runners import RunConfig
|
34
|
+
from ...utils.feature_decorator import working_in_progress
|
35
|
+
from .part_converter import convert_a2a_part_to_genai_part
|
36
|
+
from .utils import _from_a2a_context_id
|
37
|
+
from .utils import _get_adk_metadata_key
|
38
|
+
|
39
|
+
|
40
|
+
def _get_user_id(request: RequestContext, user_id_from_context: str) -> str:
|
41
|
+
# Get user from call context if available (auth is enabled on a2a server)
|
42
|
+
if request.call_context and request.call_context.user:
|
43
|
+
return request.call_context.user.user_name
|
44
|
+
|
45
|
+
# Get user from context id if available
|
46
|
+
if user_id_from_context:
|
47
|
+
return user_id_from_context
|
48
|
+
|
49
|
+
# Get user from message metadata if available (client is an ADK agent)
|
50
|
+
if request.message.metadata:
|
51
|
+
user_id = request.message.metadata.get(_get_adk_metadata_key('user_id'))
|
52
|
+
if user_id:
|
53
|
+
return f'ADK_USER_{user_id}'
|
54
|
+
|
55
|
+
# Get user from task if available (client is a an ADK agent)
|
56
|
+
if request.current_task:
|
57
|
+
user_id = request.current_task.metadata.get(
|
58
|
+
_get_adk_metadata_key('user_id')
|
59
|
+
)
|
60
|
+
if user_id:
|
61
|
+
return f'ADK_USER_{user_id}'
|
62
|
+
return (
|
63
|
+
f'temp_user_{request.task_id}'
|
64
|
+
if request.task_id
|
65
|
+
else f'TEMP_USER_{request.message.messageId}'
|
66
|
+
)
|
67
|
+
|
68
|
+
|
69
|
+
@working_in_progress
|
70
|
+
def convert_a2a_request_to_adk_run_args(
|
71
|
+
request: RequestContext,
|
72
|
+
) -> dict[str, Any]:
|
73
|
+
|
74
|
+
if not request.message:
|
75
|
+
raise ValueError('Request message cannot be None')
|
76
|
+
|
77
|
+
_, user_id, session_id = _from_a2a_context_id(request.context_id)
|
78
|
+
|
79
|
+
return {
|
80
|
+
'user_id': _get_user_id(request, user_id),
|
81
|
+
'session_id': session_id,
|
82
|
+
'new_message': genai_types.Content(
|
83
|
+
role='user',
|
84
|
+
parts=[
|
85
|
+
convert_a2a_part_to_genai_part(part)
|
86
|
+
for part in request.message.parts
|
87
|
+
],
|
88
|
+
),
|
89
|
+
'run_config': RunConfig(),
|
90
|
+
}
|
@@ -0,0 +1,71 @@
|
|
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
|
+
ADK_CONTEXT_ID_PREFIX = "ADK"
|
19
|
+
|
20
|
+
|
21
|
+
def _get_adk_metadata_key(key: str) -> str:
|
22
|
+
"""Gets the A2A event metadata key for the given key.
|
23
|
+
|
24
|
+
Args:
|
25
|
+
key: The metadata key to prefix.
|
26
|
+
|
27
|
+
Returns:
|
28
|
+
The prefixed metadata key.
|
29
|
+
|
30
|
+
Raises:
|
31
|
+
ValueError: If key is empty or None.
|
32
|
+
"""
|
33
|
+
if not key:
|
34
|
+
raise ValueError("Metadata key cannot be empty or None")
|
35
|
+
return f"{ADK_METADATA_KEY_PREFIX}{key}"
|
36
|
+
|
37
|
+
|
38
|
+
def _to_a2a_context_id(app_name: str, user_id: str, session_id: str) -> str:
|
39
|
+
"""Converts app name, user id and session id to an A2A context id.
|
40
|
+
|
41
|
+
Args:
|
42
|
+
app_name: The app name.
|
43
|
+
user_id: The user id.
|
44
|
+
session_id: The session id.
|
45
|
+
|
46
|
+
Returns:
|
47
|
+
The A2A context id.
|
48
|
+
"""
|
49
|
+
return [ADK_CONTEXT_ID_PREFIX, app_name, user_id, session_id].join("$")
|
50
|
+
|
51
|
+
|
52
|
+
def _from_a2a_context_id(context_id: str) -> tuple[str, str, str]:
|
53
|
+
"""Converts an A2A context id to app name, user id and session id.
|
54
|
+
if context_id is None, return None, None, None
|
55
|
+
if context_id is not None, but not in the format of
|
56
|
+
ADK$app_name$user_id$session_id, return None, None, None
|
57
|
+
|
58
|
+
Args:
|
59
|
+
context_id: The A2A context id.
|
60
|
+
|
61
|
+
Returns:
|
62
|
+
The app name, user id and session id.
|
63
|
+
"""
|
64
|
+
if not context_id:
|
65
|
+
return None, None, None
|
66
|
+
|
67
|
+
prefix, app_name, user_id, session_id = context_id.split("$")
|
68
|
+
if prefix == "ADK" and app_name and user_id and session_id:
|
69
|
+
return app_name, user_id, session_id
|
70
|
+
|
71
|
+
return None, None, None
|