google-adk 1.4.1__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.
Files changed (241) hide show
  1. {google_adk-1.4.1 → google_adk-1.4.2}/PKG-INFO +1 -1
  2. google_adk-1.4.2/src/google/adk/a2a/converters/event_converter.py +382 -0
  3. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/a2a/converters/part_converter.py +4 -2
  4. google_adk-1.4.2/src/google/adk/a2a/converters/utils.py +34 -0
  5. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/sessions/vertex_ai_session_service.py +18 -2
  6. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/bigquery/bigquery_credentials.py +28 -11
  7. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/bigquery/bigquery_tool.py +1 -1
  8. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/bigquery/client.py +1 -1
  9. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/bigquery/metadata_tool.py +1 -1
  10. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/bigquery/query_tool.py +1 -1
  11. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/version.py +1 -1
  12. {google_adk-1.4.1 → google_adk-1.4.2}/LICENSE +0 -0
  13. {google_adk-1.4.1 → google_adk-1.4.2}/README.md +0 -0
  14. {google_adk-1.4.1 → google_adk-1.4.2}/pyproject.toml +0 -0
  15. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/__init__.py +0 -0
  16. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/a2a/__init__.py +0 -0
  17. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/a2a/converters/__init__.py +0 -0
  18. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/__init__.py +0 -0
  19. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/active_streaming_tool.py +0 -0
  20. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/base_agent.py +0 -0
  21. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/callback_context.py +0 -0
  22. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/invocation_context.py +0 -0
  23. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/langgraph_agent.py +0 -0
  24. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/live_request_queue.py +0 -0
  25. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/llm_agent.py +0 -0
  26. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/loop_agent.py +0 -0
  27. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/parallel_agent.py +0 -0
  28. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/readonly_context.py +0 -0
  29. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/run_config.py +0 -0
  30. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/sequential_agent.py +0 -0
  31. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/agents/transcription_entry.py +0 -0
  32. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/artifacts/__init__.py +0 -0
  33. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/artifacts/base_artifact_service.py +0 -0
  34. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/artifacts/gcs_artifact_service.py +0 -0
  35. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/artifacts/in_memory_artifact_service.py +0 -0
  36. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/__init__.py +0 -0
  37. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/auth_credential.py +0 -0
  38. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/auth_handler.py +0 -0
  39. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/auth_preprocessor.py +0 -0
  40. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/auth_schemes.py +0 -0
  41. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/auth_tool.py +0 -0
  42. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/credential_manager.py +0 -0
  43. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/credential_service/__init__.py +0 -0
  44. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/credential_service/base_credential_service.py +0 -0
  45. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/credential_service/in_memory_credential_service.py +0 -0
  46. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/exchanger/__init__.py +0 -0
  47. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/exchanger/base_credential_exchanger.py +0 -0
  48. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/exchanger/credential_exchanger_registry.py +0 -0
  49. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/exchanger/oauth2_credential_exchanger.py +0 -0
  50. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/oauth2_credential_util.py +0 -0
  51. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/refresher/__init__.py +0 -0
  52. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/refresher/base_credential_refresher.py +0 -0
  53. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/refresher/credential_refresher_registry.py +0 -0
  54. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/auth/refresher/oauth2_credential_refresher.py +0 -0
  55. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/__init__.py +0 -0
  56. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/__main__.py +0 -0
  57. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/agent_graph.py +0 -0
  58. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/browser/adk_favicon.svg +0 -0
  59. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/browser/assets/ADK-512-color.svg +0 -0
  60. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/browser/assets/audio-processor.js +0 -0
  61. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/browser/assets/config/runtime-config.json +0 -0
  62. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/browser/index.html +0 -0
  63. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/browser/main-JAAWEV7F.js +0 -0
  64. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/browser/polyfills-B6TNHZQ6.js +0 -0
  65. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/browser/styles-4VDSPQ37.css +0 -0
  66. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/cli.py +0 -0
  67. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/cli_create.py +0 -0
  68. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/cli_deploy.py +0 -0
  69. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/cli_eval.py +0 -0
  70. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/cli_tools_click.py +0 -0
  71. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/fast_api.py +0 -0
  72. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/utils/__init__.py +0 -0
  73. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/utils/agent_loader.py +0 -0
  74. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/utils/cleanup.py +0 -0
  75. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/utils/common.py +0 -0
  76. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/utils/envs.py +0 -0
  77. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/utils/evals.py +0 -0
  78. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/cli/utils/logs.py +0 -0
  79. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/code_executors/__init__.py +0 -0
  80. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/code_executors/base_code_executor.py +0 -0
  81. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/code_executors/built_in_code_executor.py +0 -0
  82. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/code_executors/code_execution_utils.py +0 -0
  83. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/code_executors/code_executor_context.py +0 -0
  84. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/code_executors/container_code_executor.py +0 -0
  85. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/code_executors/unsafe_local_code_executor.py +0 -0
  86. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/code_executors/vertex_ai_code_executor.py +0 -0
  87. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/errors/__init__.py +0 -0
  88. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/errors/not_found_error.py +0 -0
  89. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/__init__.py +0 -0
  90. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/_eval_set_results_manager_utils.py +0 -0
  91. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/_eval_sets_manager_utils.py +0 -0
  92. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/agent_evaluator.py +0 -0
  93. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/eval_case.py +0 -0
  94. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/eval_metrics.py +0 -0
  95. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/eval_result.py +0 -0
  96. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/eval_set.py +0 -0
  97. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/eval_set_results_manager.py +0 -0
  98. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/eval_sets_manager.py +0 -0
  99. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/evaluation_constants.py +0 -0
  100. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/evaluation_generator.py +0 -0
  101. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/evaluator.py +0 -0
  102. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/gcs_eval_set_results_manager.py +0 -0
  103. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/gcs_eval_sets_manager.py +0 -0
  104. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/local_eval_set_results_manager.py +0 -0
  105. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/local_eval_sets_manager.py +0 -0
  106. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/response_evaluator.py +0 -0
  107. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/evaluation/trajectory_evaluator.py +0 -0
  108. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/events/__init__.py +0 -0
  109. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/events/event.py +0 -0
  110. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/events/event_actions.py +0 -0
  111. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/examples/__init__.py +0 -0
  112. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/examples/base_example_provider.py +0 -0
  113. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/examples/example.py +0 -0
  114. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/examples/example_util.py +0 -0
  115. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/examples/vertex_ai_example_store.py +0 -0
  116. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/__init__.py +0 -0
  117. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/__init__.py +0 -0
  118. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/_base_llm_processor.py +0 -0
  119. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/_code_execution.py +0 -0
  120. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/_nl_planning.py +0 -0
  121. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/agent_transfer.py +0 -0
  122. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/audio_transcriber.py +0 -0
  123. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/auto_flow.py +0 -0
  124. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/base_llm_flow.py +0 -0
  125. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/basic.py +0 -0
  126. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/contents.py +0 -0
  127. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/functions.py +0 -0
  128. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/identity.py +0 -0
  129. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/instructions.py +0 -0
  130. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/flows/llm_flows/single_flow.py +0 -0
  131. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/memory/__init__.py +0 -0
  132. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/memory/_utils.py +0 -0
  133. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/memory/base_memory_service.py +0 -0
  134. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/memory/in_memory_memory_service.py +0 -0
  135. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/memory/memory_entry.py +0 -0
  136. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/memory/vertex_ai_rag_memory_service.py +0 -0
  137. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/models/__init__.py +0 -0
  138. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/models/anthropic_llm.py +0 -0
  139. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/models/base_llm.py +0 -0
  140. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/models/base_llm_connection.py +0 -0
  141. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/models/gemini_llm_connection.py +0 -0
  142. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/models/google_llm.py +0 -0
  143. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/models/lite_llm.py +0 -0
  144. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/models/llm_request.py +0 -0
  145. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/models/llm_response.py +0 -0
  146. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/models/registry.py +0 -0
  147. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/planners/__init__.py +0 -0
  148. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/planners/base_planner.py +0 -0
  149. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/planners/built_in_planner.py +0 -0
  150. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/planners/plan_re_act_planner.py +0 -0
  151. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/platform/__init__.py +0 -0
  152. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/platform/internal/__init__.py +0 -0
  153. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/platform/internal/thread.py +0 -0
  154. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/platform/thread.py +0 -0
  155. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/py.typed +0 -0
  156. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/runners.py +0 -0
  157. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/sessions/__init__.py +0 -0
  158. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/sessions/_session_util.py +0 -0
  159. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/sessions/base_session_service.py +0 -0
  160. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/sessions/database_session_service.py +0 -0
  161. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/sessions/in_memory_session_service.py +0 -0
  162. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/sessions/session.py +0 -0
  163. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/sessions/state.py +0 -0
  164. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/telemetry.py +0 -0
  165. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/__init__.py +0 -0
  166. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/_automatic_function_calling_util.py +0 -0
  167. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/_forwarding_artifact_service.py +0 -0
  168. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/_function_parameter_parse_util.py +0 -0
  169. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/_gemini_schema_util.py +0 -0
  170. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/_memory_entry_utils.py +0 -0
  171. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/agent_tool.py +0 -0
  172. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/apihub_tool/__init__.py +0 -0
  173. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/apihub_tool/apihub_toolset.py +0 -0
  174. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/apihub_tool/clients/__init__.py +0 -0
  175. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/apihub_tool/clients/apihub_client.py +0 -0
  176. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/apihub_tool/clients/secret_client.py +0 -0
  177. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/application_integration_tool/__init__.py +0 -0
  178. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/application_integration_tool/application_integration_toolset.py +0 -0
  179. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/application_integration_tool/clients/connections_client.py +0 -0
  180. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/application_integration_tool/clients/integration_client.py +0 -0
  181. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/application_integration_tool/integration_connector_tool.py +0 -0
  182. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/authenticated_function_tool.py +0 -0
  183. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/base_authenticated_tool.py +0 -0
  184. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/base_tool.py +0 -0
  185. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/base_toolset.py +0 -0
  186. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/bigquery/__init__.py +0 -0
  187. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/bigquery/bigquery_toolset.py +0 -0
  188. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/bigquery/config.py +0 -0
  189. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/crewai_tool.py +0 -0
  190. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/enterprise_search_tool.py +0 -0
  191. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/example_tool.py +0 -0
  192. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/exit_loop_tool.py +0 -0
  193. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/function_tool.py +0 -0
  194. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/get_user_choice_tool.py +0 -0
  195. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/google_api_tool/__init__.py +0 -0
  196. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/google_api_tool/google_api_tool.py +0 -0
  197. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/google_api_tool/google_api_toolset.py +0 -0
  198. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/google_api_tool/google_api_toolsets.py +0 -0
  199. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/google_api_tool/googleapi_to_openapi_converter.py +0 -0
  200. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/google_search_tool.py +0 -0
  201. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/langchain_tool.py +0 -0
  202. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/load_artifacts_tool.py +0 -0
  203. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/load_memory_tool.py +0 -0
  204. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/load_web_page.py +0 -0
  205. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/long_running_tool.py +0 -0
  206. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/mcp_tool/__init__.py +0 -0
  207. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/mcp_tool/conversion_utils.py +0 -0
  208. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/mcp_tool/mcp_session_manager.py +0 -0
  209. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/mcp_tool/mcp_tool.py +0 -0
  210. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/mcp_tool/mcp_toolset.py +0 -0
  211. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/__init__.py +0 -0
  212. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/__init__.py +0 -0
  213. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/auth_helpers.py +0 -0
  214. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/__init__.py +0 -0
  215. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.py +0 -0
  216. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/base_credential_exchanger.py +0 -0
  217. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py +0 -0
  218. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.py +0 -0
  219. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/common/__init__.py +0 -0
  220. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/common/common.py +0 -0
  221. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/__init__.py +0 -0
  222. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.py +0 -0
  223. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_toolset.py +0 -0
  224. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py +0 -0
  225. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py +0 -0
  226. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.py +0 -0
  227. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/preload_memory_tool.py +0 -0
  228. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/retrieval/__init__.py +0 -0
  229. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/retrieval/base_retrieval_tool.py +0 -0
  230. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/retrieval/files_retrieval.py +0 -0
  231. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/retrieval/llama_index_retrieval.py +0 -0
  232. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/retrieval/vertex_ai_rag_retrieval.py +0 -0
  233. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/tool_context.py +0 -0
  234. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/toolbox_toolset.py +0 -0
  235. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/transfer_to_agent_tool.py +0 -0
  236. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/url_context_tool.py +0 -0
  237. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/tools/vertex_ai_search_tool.py +0 -0
  238. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/utils/__init__.py +0 -0
  239. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/utils/feature_decorator.py +0 -0
  240. {google_adk-1.4.1 → google_adk-1.4.2}/src/google/adk/utils/instructions_utils.py +0 -0
  241. {google_adk-1.4.1 → google_adk-1.4.2}/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.4.1
3
+ Version: 1.4.2
4
4
  Summary: Agent Development Kit
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  Requires-Python: >=3.9
@@ -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,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}"
@@ -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('httpHeaders', None):
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,
@@ -21,9 +21,10 @@ from typing import Optional
21
21
  from fastapi.openapi.models import OAuth2
22
22
  from fastapi.openapi.models import OAuthFlowAuthorizationCode
23
23
  from fastapi.openapi.models import OAuthFlows
24
+ import google.auth.credentials
24
25
  from google.auth.exceptions import RefreshError
25
26
  from google.auth.transport.requests import Request
26
- from google.oauth2.credentials import Credentials
27
+ import google.oauth2.credentials
27
28
  from pydantic import BaseModel
28
29
  from pydantic import model_validator
29
30
 
@@ -40,26 +41,35 @@ BIGQUERY_DEFAULT_SCOPE = ["https://www.googleapis.com/auth/bigquery"]
40
41
 
41
42
  @experimental
42
43
  class BigQueryCredentialsConfig(BaseModel):
43
- """Configuration for Google API tools. (Experimental)"""
44
+ """Configuration for Google API tools (Experimental).
45
+
46
+ Please do not use this in production, as it may be deprecated later.
47
+ """
44
48
 
45
49
  # Configure the model to allow arbitrary types like Credentials
46
50
  model_config = {"arbitrary_types_allowed": True}
47
51
 
48
- credentials: Optional[Credentials] = None
49
- """the existing oauth credentials to use. If set,this credential will be used
52
+ credentials: Optional[google.auth.credentials.Credentials] = None
53
+ """The existing auth credentials to use. If set, this credential will be used
50
54
  for every end user, end users don't need to be involved in the oauthflow. This
51
55
  field is mutually exclusive with client_id, client_secret and scopes.
52
56
  Don't set this field unless you are sure this credential has the permission to
53
57
  access every end user's data.
54
58
 
55
- Example usage: when the agent is deployed in Google Cloud environment and
59
+ Example usage 1: When the agent is deployed in Google Cloud environment and
56
60
  the service account (used as application default credentials) has access to
57
61
  all the required BigQuery resource. Setting this credential to allow user to
58
62
  access the BigQuery resource without end users going through oauth flow.
59
63
 
60
- To get application default credential: `google.auth.default(...)`. See more
64
+ To get application default credential, use: `google.auth.default(...)`. See more
61
65
  details in https://cloud.google.com/docs/authentication/application-default-credentials.
62
66
 
67
+ Example usage 2: When the agent wants to access the user's BigQuery resources
68
+ using the service account key credentials.
69
+
70
+ To load service account key credentials, use: `google.auth.load_credentials_from_file(...)`.
71
+ See more details in https://cloud.google.com/iam/docs/service-account-creds#user-managed-keys.
72
+
63
73
  When the deployed environment cannot provide a pre-existing credential,
64
74
  consider setting below client_id, client_secret and scope for end users to go
65
75
  through oauth flow, so that agent can access the user data.
@@ -86,7 +96,9 @@ class BigQueryCredentialsConfig(BaseModel):
86
96
  " client_id/client_secret/scopes."
87
97
  )
88
98
 
89
- if self.credentials:
99
+ if self.credentials and isinstance(
100
+ self.credentials, google.oauth2.credentials.Credentials
101
+ ):
90
102
  self.client_id = self.credentials.client_id
91
103
  self.client_secret = self.credentials.client_secret
92
104
  self.scopes = self.credentials.scopes
@@ -115,7 +127,7 @@ class BigQueryCredentialsManager:
115
127
 
116
128
  async def get_valid_credentials(
117
129
  self, tool_context: ToolContext
118
- ) -> Optional[Credentials]:
130
+ ) -> Optional[google.auth.credentials.Credentials]:
119
131
  """Get valid credentials, handling refresh and OAuth flow as needed.
120
132
 
121
133
  Args:
@@ -127,7 +139,7 @@ class BigQueryCredentialsManager:
127
139
  # First, try to get credentials from the tool context
128
140
  creds_json = tool_context.state.get(BIGQUERY_TOKEN_CACHE_KEY, None)
129
141
  creds = (
130
- Credentials.from_authorized_user_info(
142
+ google.oauth2.credentials.Credentials.from_authorized_user_info(
131
143
  json.loads(creds_json), self.credentials_config.scopes
132
144
  )
133
145
  if creds_json
@@ -138,6 +150,11 @@ class BigQueryCredentialsManager:
138
150
  if not creds:
139
151
  creds = self.credentials_config.credentials
140
152
 
153
+ # If non-oauth credentials are provided then use them as is. This helps
154
+ # in flows such as service account keys
155
+ if creds and not isinstance(creds, google.oauth2.credentials.Credentials):
156
+ return creds
157
+
141
158
  # Check if we have valid credentials
142
159
  if creds and creds.valid:
143
160
  return creds
@@ -159,7 +176,7 @@ class BigQueryCredentialsManager:
159
176
 
160
177
  async def _perform_oauth_flow(
161
178
  self, tool_context: ToolContext
162
- ) -> Optional[Credentials]:
179
+ ) -> Optional[google.oauth2.credentials.Credentials]:
163
180
  """Perform OAuth flow to get new credentials.
164
181
 
165
182
  Args:
@@ -199,7 +216,7 @@ class BigQueryCredentialsManager:
199
216
 
200
217
  if auth_response:
201
218
  # OAuth flow completed, create credentials
202
- creds = Credentials(
219
+ creds = google.oauth2.credentials.Credentials(
203
220
  token=auth_response.oauth2.access_token,
204
221
  refresh_token=auth_response.oauth2.refresh_token,
205
222
  token_uri=auth_scheme.flows.authorizationCode.tokenUrl,
@@ -19,7 +19,7 @@ from typing import Any
19
19
  from typing import Callable
20
20
  from typing import Optional
21
21
 
22
- from google.oauth2.credentials import Credentials
22
+ from google.auth.credentials import Credentials
23
23
  from typing_extensions import override
24
24
 
25
25
  from ...utils.feature_decorator import experimental
@@ -15,8 +15,8 @@
15
15
  from __future__ import annotations
16
16
 
17
17
  import google.api_core.client_info
18
+ from google.auth.credentials import Credentials
18
19
  from google.cloud import bigquery
19
- from google.oauth2.credentials import Credentials
20
20
 
21
21
  from ... import version
22
22
 
@@ -12,8 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ from google.auth.credentials import Credentials
15
16
  from google.cloud import bigquery
16
- from google.oauth2.credentials import Credentials
17
17
 
18
18
  from . import client
19
19
 
@@ -16,8 +16,8 @@ import functools
16
16
  import types
17
17
  from typing import Callable
18
18
 
19
+ from google.auth.credentials import Credentials
19
20
  from google.cloud import bigquery
20
- from google.oauth2.credentials import Credentials
21
21
 
22
22
  from . import client
23
23
  from .config import BigQueryToolConfig
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
 
15
15
  # version: major.minor.patch
16
- __version__ = "1.4.1"
16
+ __version__ = "1.4.2"
File without changes
File without changes
File without changes