google-adk 1.2.1__tar.gz → 1.4.1__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 (243) hide show
  1. {google_adk-1.2.1 → google_adk-1.4.1}/PKG-INFO +10 -2
  2. {google_adk-1.2.1 → google_adk-1.4.1}/README.md +1 -0
  3. {google_adk-1.2.1 → google_adk-1.4.1}/pyproject.toml +36 -19
  4. google_adk-1.4.1/src/google/adk/a2a/converters/part_converter.py +177 -0
  5. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/invocation_context.py +2 -0
  6. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/llm_agent.py +1 -6
  7. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/run_config.py +11 -0
  8. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/auth/auth_credential.py +4 -0
  9. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/auth/auth_handler.py +22 -96
  10. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/auth/auth_preprocessor.py +3 -3
  11. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/auth/auth_tool.py +46 -0
  12. google_adk-1.4.1/src/google/adk/auth/credential_manager.py +261 -0
  13. google_adk-1.4.1/src/google/adk/auth/credential_service/base_credential_service.py +75 -0
  14. google_adk-1.4.1/src/google/adk/auth/credential_service/in_memory_credential_service.py +64 -0
  15. google_adk-1.4.1/src/google/adk/auth/exchanger/__init__.py +21 -0
  16. google_adk-1.4.1/src/google/adk/auth/exchanger/base_credential_exchanger.py +57 -0
  17. google_adk-1.4.1/src/google/adk/auth/exchanger/credential_exchanger_registry.py +58 -0
  18. google_adk-1.4.1/src/google/adk/auth/exchanger/oauth2_credential_exchanger.py +104 -0
  19. google_adk-1.4.1/src/google/adk/auth/oauth2_credential_util.py +107 -0
  20. google_adk-1.4.1/src/google/adk/auth/refresher/__init__.py +21 -0
  21. google_adk-1.4.1/src/google/adk/auth/refresher/base_credential_refresher.py +74 -0
  22. google_adk-1.4.1/src/google/adk/auth/refresher/credential_refresher_registry.py +59 -0
  23. google_adk-1.4.1/src/google/adk/auth/refresher/oauth2_credential_refresher.py +126 -0
  24. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/agent_graph.py +34 -32
  25. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/browser/index.html +2 -2
  26. google_adk-1.4.1/src/google/adk/cli/browser/main-JAAWEV7F.js +92 -0
  27. google_adk-1.4.1/src/google/adk/cli/browser/polyfills-B6TNHZQ6.js +17 -0
  28. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/cli.py +10 -0
  29. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/cli_deploy.py +80 -21
  30. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/cli_tools_click.py +132 -61
  31. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/fast_api.py +46 -41
  32. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/utils/agent_loader.py +15 -2
  33. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/code_executors/container_code_executor.py +10 -6
  34. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/code_executors/vertex_ai_code_executor.py +8 -2
  35. google_adk-1.4.1/src/google/adk/evaluation/_eval_set_results_manager_utils.py +44 -0
  36. google_adk-1.4.1/src/google/adk/evaluation/_eval_sets_manager_utils.py +108 -0
  37. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/eval_metrics.py +0 -5
  38. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/eval_result.py +12 -7
  39. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/eval_set_results_manager.py +6 -1
  40. google_adk-1.4.1/src/google/adk/evaluation/gcs_eval_set_results_manager.py +121 -0
  41. google_adk-1.4.1/src/google/adk/evaluation/gcs_eval_sets_manager.py +196 -0
  42. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/local_eval_set_results_manager.py +6 -18
  43. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/local_eval_sets_manager.py +27 -78
  44. google_adk-1.4.1/src/google/adk/flows/__init__.py +13 -0
  45. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/basic.py +9 -0
  46. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/functions.py +1 -2
  47. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/models/anthropic_llm.py +1 -1
  48. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/models/gemini_llm_connection.py +2 -0
  49. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/models/google_llm.py +57 -16
  50. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/models/lite_llm.py +2 -1
  51. google_adk-1.4.1/src/google/adk/platform/__init__.py +13 -0
  52. google_adk-1.4.1/src/google/adk/platform/internal/__init__.py +15 -0
  53. google_adk-1.4.1/src/google/adk/platform/internal/thread.py +30 -0
  54. google_adk-1.4.1/src/google/adk/platform/thread.py +31 -0
  55. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/runners.py +8 -2
  56. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/sessions/in_memory_session_service.py +12 -1
  57. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/sessions/vertex_ai_session_service.py +71 -50
  58. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/__init__.py +2 -0
  59. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/_automatic_function_calling_util.py +1 -0
  60. google_adk-1.4.1/src/google/adk/tools/_forwarding_artifact_service.py +96 -0
  61. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/_function_parameter_parse_util.py +1 -0
  62. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/agent_tool.py +5 -39
  63. google_adk-1.4.1/src/google/adk/tools/apihub_tool/clients/__init__.py +13 -0
  64. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/application_integration_tool/integration_connector_tool.py +2 -2
  65. google_adk-1.4.1/src/google/adk/tools/authenticated_function_tool.py +107 -0
  66. google_adk-1.4.1/src/google/adk/tools/base_authenticated_tool.py +107 -0
  67. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/bigquery/bigquery_credentials.py +6 -4
  68. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/bigquery/bigquery_tool.py +22 -9
  69. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/bigquery/bigquery_toolset.py +9 -3
  70. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/bigquery/client.py +7 -3
  71. google_adk-1.4.1/src/google/adk/tools/bigquery/config.py +46 -0
  72. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/bigquery/metadata_tool.py +114 -91
  73. google_adk-1.4.1/src/google/adk/tools/bigquery/query_tool.py +194 -0
  74. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/google_api_tool/googleapi_to_openapi_converter.py +7 -4
  75. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/google_search_tool.py +0 -1
  76. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/mcp_tool/__init__.py +6 -0
  77. google_adk-1.4.1/src/google/adk/tools/mcp_tool/mcp_session_manager.py +381 -0
  78. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/mcp_tool/mcp_tool.py +73 -22
  79. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/mcp_tool/mcp_toolset.py +32 -29
  80. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py +3 -3
  81. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.py +55 -33
  82. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/retrieval/files_retrieval.py +7 -1
  83. google_adk-1.4.1/src/google/adk/tools/url_context_tool.py +61 -0
  84. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/vertex_ai_search_tool.py +13 -2
  85. google_adk-1.4.1/src/google/adk/utils/__init__.py +13 -0
  86. google_adk-1.4.1/src/google/adk/utils/feature_decorator.py +175 -0
  87. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/version.py +1 -1
  88. google_adk-1.2.1/src/google/adk/cli/browser/main-CS5OLUMF.js +0 -91
  89. google_adk-1.2.1/src/google/adk/cli/browser/polyfills-FFHMD2TL.js +0 -17
  90. google_adk-1.2.1/src/google/adk/tools/bigquery/query_tool.py +0 -76
  91. google_adk-1.2.1/src/google/adk/tools/mcp_tool/mcp_session_manager.py +0 -259
  92. {google_adk-1.2.1 → google_adk-1.4.1}/LICENSE +0 -0
  93. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/__init__.py +0 -0
  94. {google_adk-1.2.1/src/google/adk/errors → google_adk-1.4.1/src/google/adk/a2a}/__init__.py +0 -0
  95. {google_adk-1.2.1/src/google/adk/flows → google_adk-1.4.1/src/google/adk/a2a/converters}/__init__.py +0 -0
  96. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/__init__.py +0 -0
  97. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/active_streaming_tool.py +0 -0
  98. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/base_agent.py +0 -0
  99. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/callback_context.py +0 -0
  100. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/langgraph_agent.py +0 -0
  101. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/live_request_queue.py +0 -0
  102. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/loop_agent.py +0 -0
  103. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/parallel_agent.py +0 -0
  104. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/readonly_context.py +0 -0
  105. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/sequential_agent.py +0 -0
  106. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/agents/transcription_entry.py +0 -0
  107. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/artifacts/__init__.py +0 -0
  108. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/artifacts/base_artifact_service.py +0 -0
  109. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/artifacts/gcs_artifact_service.py +0 -0
  110. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/artifacts/in_memory_artifact_service.py +0 -0
  111. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/auth/__init__.py +0 -0
  112. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/auth/auth_schemes.py +0 -0
  113. {google_adk-1.2.1/src/google/adk/tools/apihub_tool/clients → google_adk-1.4.1/src/google/adk/auth/credential_service}/__init__.py +0 -0
  114. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/__init__.py +0 -0
  115. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/__main__.py +0 -0
  116. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/browser/adk_favicon.svg +0 -0
  117. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/browser/assets/ADK-512-color.svg +0 -0
  118. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/browser/assets/audio-processor.js +0 -0
  119. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/browser/assets/config/runtime-config.json +0 -0
  120. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/browser/styles-4VDSPQ37.css +0 -0
  121. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/cli_create.py +0 -0
  122. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/cli_eval.py +0 -0
  123. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/utils/__init__.py +0 -0
  124. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/utils/cleanup.py +0 -0
  125. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/utils/common.py +0 -0
  126. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/utils/envs.py +0 -0
  127. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/utils/evals.py +0 -0
  128. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/cli/utils/logs.py +0 -0
  129. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/code_executors/__init__.py +0 -0
  130. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/code_executors/base_code_executor.py +0 -0
  131. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/code_executors/built_in_code_executor.py +0 -0
  132. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/code_executors/code_execution_utils.py +0 -0
  133. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/code_executors/code_executor_context.py +0 -0
  134. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/code_executors/unsafe_local_code_executor.py +0 -0
  135. {google_adk-1.2.1/src/google/adk/utils → google_adk-1.4.1/src/google/adk/errors}/__init__.py +0 -0
  136. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/errors/not_found_error.py +0 -0
  137. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/__init__.py +0 -0
  138. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/agent_evaluator.py +0 -0
  139. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/eval_case.py +0 -0
  140. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/eval_set.py +0 -0
  141. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/eval_sets_manager.py +0 -0
  142. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/evaluation_constants.py +0 -0
  143. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/evaluation_generator.py +0 -0
  144. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/evaluator.py +0 -0
  145. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/response_evaluator.py +0 -0
  146. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/evaluation/trajectory_evaluator.py +0 -0
  147. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/events/__init__.py +0 -0
  148. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/events/event.py +0 -0
  149. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/events/event_actions.py +0 -0
  150. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/examples/__init__.py +0 -0
  151. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/examples/base_example_provider.py +0 -0
  152. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/examples/example.py +0 -0
  153. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/examples/example_util.py +0 -0
  154. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/examples/vertex_ai_example_store.py +0 -0
  155. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/__init__.py +0 -0
  156. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/_base_llm_processor.py +0 -0
  157. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/_code_execution.py +0 -0
  158. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/_nl_planning.py +0 -0
  159. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/agent_transfer.py +0 -0
  160. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/audio_transcriber.py +0 -0
  161. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/auto_flow.py +0 -0
  162. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/base_llm_flow.py +0 -0
  163. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/contents.py +0 -0
  164. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/identity.py +0 -0
  165. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/instructions.py +0 -0
  166. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/flows/llm_flows/single_flow.py +0 -0
  167. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/memory/__init__.py +0 -0
  168. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/memory/_utils.py +0 -0
  169. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/memory/base_memory_service.py +0 -0
  170. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/memory/in_memory_memory_service.py +0 -0
  171. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/memory/memory_entry.py +0 -0
  172. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/memory/vertex_ai_rag_memory_service.py +0 -0
  173. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/models/__init__.py +0 -0
  174. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/models/base_llm.py +0 -0
  175. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/models/base_llm_connection.py +0 -0
  176. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/models/llm_request.py +0 -0
  177. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/models/llm_response.py +0 -0
  178. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/models/registry.py +0 -0
  179. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/planners/__init__.py +0 -0
  180. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/planners/base_planner.py +0 -0
  181. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/planners/built_in_planner.py +0 -0
  182. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/planners/plan_re_act_planner.py +0 -0
  183. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/py.typed +0 -0
  184. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/sessions/__init__.py +0 -0
  185. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/sessions/_session_util.py +0 -0
  186. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/sessions/base_session_service.py +0 -0
  187. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/sessions/database_session_service.py +0 -0
  188. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/sessions/session.py +0 -0
  189. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/sessions/state.py +0 -0
  190. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/telemetry.py +0 -0
  191. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/_gemini_schema_util.py +0 -0
  192. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/_memory_entry_utils.py +0 -0
  193. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/apihub_tool/__init__.py +0 -0
  194. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/apihub_tool/apihub_toolset.py +0 -0
  195. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/apihub_tool/clients/apihub_client.py +0 -0
  196. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/apihub_tool/clients/secret_client.py +0 -0
  197. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/application_integration_tool/__init__.py +0 -0
  198. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/application_integration_tool/application_integration_toolset.py +0 -0
  199. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/application_integration_tool/clients/connections_client.py +0 -0
  200. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/application_integration_tool/clients/integration_client.py +0 -0
  201. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/base_tool.py +0 -0
  202. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/base_toolset.py +0 -0
  203. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/bigquery/__init__.py +0 -0
  204. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/crewai_tool.py +0 -0
  205. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/enterprise_search_tool.py +0 -0
  206. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/example_tool.py +0 -0
  207. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/exit_loop_tool.py +0 -0
  208. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/function_tool.py +0 -0
  209. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/get_user_choice_tool.py +0 -0
  210. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/google_api_tool/__init__.py +0 -0
  211. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/google_api_tool/google_api_tool.py +0 -0
  212. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/google_api_tool/google_api_toolset.py +0 -0
  213. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/google_api_tool/google_api_toolsets.py +0 -0
  214. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/langchain_tool.py +0 -0
  215. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/load_artifacts_tool.py +0 -0
  216. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/load_memory_tool.py +0 -0
  217. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/load_web_page.py +0 -0
  218. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/long_running_tool.py +0 -0
  219. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/mcp_tool/conversion_utils.py +0 -0
  220. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/__init__.py +0 -0
  221. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/auth/__init__.py +0 -0
  222. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/auth/auth_helpers.py +0 -0
  223. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/__init__.py +0 -0
  224. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.py +0 -0
  225. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/base_credential_exchanger.py +0 -0
  226. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py +0 -0
  227. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.py +0 -0
  228. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/common/__init__.py +0 -0
  229. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/common/common.py +0 -0
  230. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/openapi_spec_parser/__init__.py +0 -0
  231. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.py +0 -0
  232. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_toolset.py +0 -0
  233. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py +0 -0
  234. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/preload_memory_tool.py +0 -0
  235. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/retrieval/__init__.py +0 -0
  236. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/retrieval/base_retrieval_tool.py +0 -0
  237. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/retrieval/llama_index_retrieval.py +0 -0
  238. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/retrieval/vertex_ai_rag_retrieval.py +0 -0
  239. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/tool_context.py +0 -0
  240. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/toolbox_toolset.py +0 -0
  241. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/tools/transfer_to_agent_tool.py +0 -0
  242. {google_adk-1.2.1 → google_adk-1.4.1}/src/google/adk/utils/instructions_utils.py +0 -0
  243. {google_adk-1.2.1 → google_adk-1.4.1}/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.2.1
3
+ Version: 1.4.1
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: anyio>=4.9.0;python_version>='3.10'
22
23
  Requires-Dist: authlib>=1.5.1
23
24
  Requires-Dist: click>=8.1.8
24
25
  Requires-Dist: fastapi>=0.115.0
@@ -34,12 +35,17 @@ Requires-Dist: opentelemetry-api>=1.31.0
34
35
  Requires-Dist: opentelemetry-exporter-gcp-trace>=1.9.0
35
36
  Requires-Dist: opentelemetry-sdk>=1.31.0
36
37
  Requires-Dist: pydantic>=2.0, <3.0.0
38
+ Requires-Dist: python-dateutil>=2.9.0.post0
37
39
  Requires-Dist: python-dotenv>=1.0.0
38
40
  Requires-Dist: PyYAML>=6.0.2
41
+ Requires-Dist: requests>=2.32.4
39
42
  Requires-Dist: sqlalchemy>=2.0
40
- Requires-Dist: tzlocal>=5.3
43
+ Requires-Dist: starlette>=0.46.2
41
44
  Requires-Dist: typing-extensions>=4.5, <5
45
+ Requires-Dist: tzlocal>=5.3
42
46
  Requires-Dist: uvicorn>=0.34.0
47
+ Requires-Dist: websockets>=15.0.1
48
+ Requires-Dist: a2a-sdk>=0.2.7 ; extra == "a2a" and (python_version>='3.10')
43
49
  Requires-Dist: flit>=3.10.0 ; extra == "dev"
44
50
  Requires-Dist: isort>=6.0.0 ; extra == "dev"
45
51
  Requires-Dist: pyink>=24.10.0 ; extra == "dev"
@@ -76,6 +82,7 @@ Project-URL: changelog, https://github.com/google/adk-python/blob/main/CHANGELOG
76
82
  Project-URL: documentation, https://google.github.io/adk-docs/
77
83
  Project-URL: homepage, https://google.github.io/adk-docs/
78
84
  Project-URL: repository, https://github.com/google/adk-python
85
+ Provides-Extra: a2a
79
86
  Provides-Extra: dev
80
87
  Provides-Extra: docs
81
88
  Provides-Extra: eval
@@ -87,6 +94,7 @@ Provides-Extra: test
87
94
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
88
95
  [![Python Unit Tests](https://github.com/google/adk-python/actions/workflows/python-unit-tests.yml/badge.svg)](https://github.com/google/adk-python/actions/workflows/python-unit-tests.yml)
89
96
  [![r/agentdevelopmentkit](https://img.shields.io/badge/Reddit-r%2Fagentdevelopmentkit-FF4500?style=flat&logo=reddit&logoColor=white)](https://www.reddit.com/r/agentdevelopmentkit/)
97
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/google/adk-python)
90
98
 
91
99
  <html>
92
100
  <h2 align="center">
@@ -3,6 +3,7 @@
3
3
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
4
4
  [![Python Unit Tests](https://github.com/google/adk-python/actions/workflows/python-unit-tests.yml/badge.svg)](https://github.com/google/adk-python/actions/workflows/python-unit-tests.yml)
5
5
  [![r/agentdevelopmentkit](https://img.shields.io/badge/Reddit-r%2Fagentdevelopmentkit-FF4500?style=flat&logo=reddit&logoColor=white)](https://www.reddit.com/r/agentdevelopmentkit/)
6
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/google/adk-python)
6
7
 
7
8
  <html>
8
9
  <h2 align="center">
@@ -25,27 +25,32 @@ classifiers = [ # List of https://pypi.org/classifiers/
25
25
  ]
26
26
  dependencies = [
27
27
  # go/keep-sorted start
28
- "authlib>=1.5.1", # For RestAPI Tool
29
- "click>=8.1.8", # For CLI tools
30
- "fastapi>=0.115.0", # FastAPI framework
31
- "google-api-python-client>=2.157.0", # Google API client discovery
32
- "google-cloud-aiplatform[agent_engines]>=1.95.1", # For VertexAI integrations, e.g. example store.
33
- "google-cloud-secret-manager>=2.22.0", # Fetching secrets in RestAPI Tool
34
- "google-cloud-speech>=2.30.0", # For Audio Transcription
35
- "google-cloud-storage>=2.18.0, <3.0.0", # For GCS Artifact service
36
- "google-genai>=1.17.0", # Google GenAI SDK
37
- "graphviz>=0.20.2", # Graphviz for graph rendering
38
- "mcp>=1.8.0;python_version>='3.10'", # For MCP Toolset
39
- "opentelemetry-api>=1.31.0", # OpenTelemetry
28
+ "anyio>=4.9.0;python_version>='3.10'", # For MCP Session Manager
29
+ "authlib>=1.5.1", # For RestAPI Tool
30
+ "click>=8.1.8", # For CLI tools
31
+ "fastapi>=0.115.0", # FastAPI framework
32
+ "google-api-python-client>=2.157.0", # Google API client discovery
33
+ "google-cloud-aiplatform[agent_engines]>=1.95.1", # For VertexAI integrations, e.g. example store.
34
+ "google-cloud-secret-manager>=2.22.0", # Fetching secrets in RestAPI Tool
35
+ "google-cloud-speech>=2.30.0", # For Audio Transcription
36
+ "google-cloud-storage>=2.18.0, <3.0.0", # For GCS Artifact service
37
+ "google-genai>=1.17.0", # Google GenAI SDK
38
+ "graphviz>=0.20.2", # Graphviz for graph rendering
39
+ "mcp>=1.8.0;python_version>='3.10'", # For MCP Toolset
40
+ "opentelemetry-api>=1.31.0", # OpenTelemetry
40
41
  "opentelemetry-exporter-gcp-trace>=1.9.0",
41
42
  "opentelemetry-sdk>=1.31.0",
42
- "pydantic>=2.0, <3.0.0", # For data validation/models
43
- "python-dotenv>=1.0.0", # To manage environment variables
44
- "PyYAML>=6.0.2", # For APIHubToolset.
45
- "sqlalchemy>=2.0", # SQL database ORM
46
- "tzlocal>=5.3", # Time zone utilities
43
+ "pydantic>=2.0, <3.0.0", # For data validation/models
44
+ "python-dateutil>=2.9.0.post0", # For Vertext AI Session Service
45
+ "python-dotenv>=1.0.0", # To manage environment variables
46
+ "PyYAML>=6.0.2", # For APIHubToolset.
47
+ "requests>=2.32.4",
48
+ "sqlalchemy>=2.0", # SQL database ORM
49
+ "starlette>=0.46.2", # For FastAPI CLI
47
50
  "typing-extensions>=4.5, <5",
48
- "uvicorn>=0.34.0", # ASGI server for FastAPI
51
+ "tzlocal>=5.3", # Time zone utilities
52
+ "uvicorn>=0.34.0", # ASGI server for FastAPI
53
+ "websockets>=15.0.1", # For BaseLlmFlow
49
54
  # go/keep-sorted end
50
55
  ]
51
56
  dynamic = ["version"]
@@ -71,6 +76,12 @@ dev = [
71
76
  # go/keep-sorted end
72
77
  ]
73
78
 
79
+ a2a = [
80
+ # go/keep-sorted start
81
+ "a2a-sdk>=0.2.7;python_version>='3.10'"
82
+ # go/keep-sorted end
83
+ ]
84
+
74
85
  eval = [
75
86
  # go/keep-sorted start
76
87
  "google-cloud-aiplatform[evaluation]>=1.87.0",
@@ -84,7 +95,7 @@ test = [
84
95
  "anthropic>=0.43.0", # For anthropic model tests
85
96
  "langchain-community>=0.3.17",
86
97
  "langgraph>=0.2.60", # For LangGraphAgent
87
- "litellm>=1.71.2", # For LiteLLM tests
98
+ "litellm>=1.71.2", # For LiteLLM tests
88
99
  "llama-index-readers-file>=0.4.0", # For retrieval tests
89
100
 
90
101
  "pytest-asyncio>=0.25.0",
@@ -140,24 +151,30 @@ pyink-annotation-pragmas = [
140
151
  requires = ["flit_core >=3.8,<4"]
141
152
  build-backend = "flit_core.buildapi"
142
153
 
154
+
143
155
  [tool.flit.sdist]
144
156
  include = ['src/**/*', 'README.md', 'pyproject.toml', 'LICENSE']
145
157
  exclude = ['src/**/*.sh']
146
158
 
159
+
147
160
  [tool.flit.module]
148
161
  name = "google.adk"
149
162
  include = ["py.typed"]
150
163
 
164
+
151
165
  [tool.isort]
152
166
  profile = "google"
153
167
  single_line_exclusions = []
168
+ line_length = 200 # Prevent line wrap flickering.
154
169
  known_third_party = ["google.adk"]
155
170
 
171
+
156
172
  [tool.pytest.ini_options]
157
173
  testpaths = ["tests"]
158
174
  asyncio_default_fixture_loop_scope = "function"
159
175
  asyncio_mode = "auto"
160
176
 
177
+
161
178
  [tool.mypy]
162
179
  python_version = "3.9"
163
180
  exclude = "tests/"
@@ -0,0 +1,177 @@
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
+ """
16
+ module containing utilities for conversion betwen A2A Part and Google GenAI Part
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ import json
22
+ import logging
23
+ import sys
24
+ from typing import Optional
25
+
26
+ try:
27
+ from a2a import types as a2a_types
28
+ except ImportError as e:
29
+ if sys.version_info < (3, 10):
30
+ raise ImportError(
31
+ 'A2A Tool requires Python 3.10 or above. Please upgrade your Python'
32
+ ' version.'
33
+ ) from e
34
+ else:
35
+ raise e
36
+
37
+ from google.genai import types as genai_types
38
+
39
+ from ...utils.feature_decorator import working_in_progress
40
+
41
+ logger = logging.getLogger('google_adk.' + __name__)
42
+
43
+ A2A_DATA_PART_METADATA_TYPE_KEY = 'type'
44
+ A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL = 'function_call'
45
+ A2A_DATA_PART_METADATA_TYPE_FUNCTION_RESPONSE = 'function_response'
46
+
47
+
48
+ @working_in_progress
49
+ def convert_a2a_part_to_genai_part(
50
+ a2a_part: a2a_types.Part,
51
+ ) -> Optional[genai_types.Part]:
52
+ """Convert an A2A Part to a Google GenAI Part."""
53
+ part = a2a_part.root
54
+ if isinstance(part, a2a_types.TextPart):
55
+ return genai_types.Part(text=part.text)
56
+
57
+ if isinstance(part, a2a_types.FilePart):
58
+ if isinstance(part.file, a2a_types.FileWithUri):
59
+ return genai_types.Part(
60
+ file_data=genai_types.FileData(
61
+ file_uri=part.file.uri, mime_type=part.file.mimeType
62
+ )
63
+ )
64
+
65
+ elif isinstance(part.file, a2a_types.FileWithBytes):
66
+ return genai_types.Part(
67
+ inline_data=genai_types.Blob(
68
+ data=part.file.bytes.encode('utf-8'), mime_type=part.file.mimeType
69
+ )
70
+ )
71
+ else:
72
+ logger.warning(
73
+ 'Cannot convert unsupported file type: %s for A2A part: %s',
74
+ type(part.file),
75
+ a2a_part,
76
+ )
77
+ return None
78
+
79
+ if isinstance(part, a2a_types.DataPart):
80
+ # Conver the Data Part to funcall and function reponse.
81
+ # This is mainly for converting human in the loop and auth request and
82
+ # response.
83
+ # TODO once A2A defined how to suervice such information, migrate below
84
+ # logic accordinlgy
85
+ if part.metadata and A2A_DATA_PART_METADATA_TYPE_KEY in part.metadata:
86
+ if (
87
+ part.metadata[A2A_DATA_PART_METADATA_TYPE_KEY]
88
+ == A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
89
+ ):
90
+ return genai_types.Part(
91
+ function_call=genai_types.FunctionCall.model_validate(
92
+ part.data, by_alias=True
93
+ )
94
+ )
95
+ if (
96
+ part.metadata[A2A_DATA_PART_METADATA_TYPE_KEY]
97
+ == A2A_DATA_PART_METADATA_TYPE_FUNCTION_RESPONSE
98
+ ):
99
+ return genai_types.Part(
100
+ function_response=genai_types.FunctionResponse.model_validate(
101
+ part.data, by_alias=True
102
+ )
103
+ )
104
+ return genai_types.Part(text=json.dumps(part.data))
105
+
106
+ logger.warning(
107
+ 'Cannot convert unsupported part type: %s for A2A part: %s',
108
+ type(part),
109
+ a2a_part,
110
+ )
111
+ return None
112
+
113
+
114
+ @working_in_progress
115
+ def convert_genai_part_to_a2a_part(
116
+ part: genai_types.Part,
117
+ ) -> Optional[a2a_types.Part]:
118
+ """Convert a Google GenAI Part to an A2A Part."""
119
+ if part.text:
120
+ return a2a_types.TextPart(text=part.text)
121
+
122
+ if part.file_data:
123
+ return a2a_types.FilePart(
124
+ file=a2a_types.FileWithUri(
125
+ uri=part.file_data.file_uri,
126
+ mimeType=part.file_data.mime_type,
127
+ )
128
+ )
129
+
130
+ if part.inline_data:
131
+ return a2a_types.Part(
132
+ root=a2a_types.FilePart(
133
+ file=a2a_types.FileWithBytes(
134
+ bytes=part.inline_data.data,
135
+ mimeType=part.inline_data.mime_type,
136
+ )
137
+ )
138
+ )
139
+
140
+ # Conver the funcall and function reponse to A2A DataPart.
141
+ # This is mainly for converting human in the loop and auth request and
142
+ # response.
143
+ # TODO once A2A defined how to suervice such information, migrate below
144
+ # logic accordinlgy
145
+ if part.function_call:
146
+ return a2a_types.Part(
147
+ root=a2a_types.DataPart(
148
+ data=part.function_call.model_dump(
149
+ by_alias=True, exclude_none=True
150
+ ),
151
+ metadata={
152
+ A2A_DATA_PART_METADATA_TYPE_KEY: (
153
+ A2A_DATA_PART_METADATA_TYPE_FUNCTION_CALL
154
+ )
155
+ },
156
+ )
157
+ )
158
+
159
+ if part.function_response:
160
+ return a2a_types.Part(
161
+ root=a2a_types.DataPart(
162
+ data=part.function_response.model_dump(
163
+ by_alias=True, exclude_none=True
164
+ ),
165
+ metadata={
166
+ A2A_DATA_PART_METADATA_TYPE_KEY: (
167
+ A2A_DATA_PART_METADATA_TYPE_FUNCTION_RESPONSE
168
+ )
169
+ },
170
+ )
171
+ )
172
+
173
+ logger.warning(
174
+ 'Cannot convert unsupported part for Google GenAI part: %s',
175
+ part,
176
+ )
177
+ return None
@@ -22,6 +22,7 @@ from pydantic import BaseModel
22
22
  from pydantic import ConfigDict
23
23
 
24
24
  from ..artifacts.base_artifact_service import BaseArtifactService
25
+ from ..auth.credential_service.base_credential_service import BaseCredentialService
25
26
  from ..memory.base_memory_service import BaseMemoryService
26
27
  from ..sessions.base_session_service import BaseSessionService
27
28
  from ..sessions.session import Session
@@ -115,6 +116,7 @@ class InvocationContext(BaseModel):
115
116
  artifact_service: Optional[BaseArtifactService] = None
116
117
  session_service: BaseSessionService
117
118
  memory_service: Optional[BaseMemoryService] = None
119
+ credential_service: Optional[BaseCredentialService] = None
118
120
 
119
121
  invocation_id: str
120
122
  """The id of this invocation context. Readonly."""
@@ -129,7 +129,7 @@ class LlmAgent(BaseAgent):
129
129
  global_instruction: Union[str, InstructionProvider] = ''
130
130
  """Instructions for all the agents in the entire agent tree.
131
131
 
132
- global_instruction ONLY takes effect in root agent.
132
+ ONLY the global_instruction in root agent will take effect.
133
133
 
134
134
  For example: use global_instruction to make all agents have a stable identity
135
135
  or personality.
@@ -204,11 +204,6 @@ class LlmAgent(BaseAgent):
204
204
  """
205
205
  # Advance features - End
206
206
 
207
- # TODO: remove below fields after migration. - Start
208
- # These fields are added back for easier migration.
209
- examples: Optional[ExamplesUnion] = None
210
- # TODO: remove above fields after migration. - End
211
-
212
207
  # Callbacks - Start
213
208
  before_model_callback: Optional[BeforeModelCallback] = None
214
209
  """Callback or list of callbacks to be called before calling the LLM.
@@ -12,6 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ from __future__ import annotations
16
+
15
17
  from enum import Enum
16
18
  import logging
17
19
  import sys
@@ -68,6 +70,15 @@ class RunConfig(BaseModel):
68
70
  input_audio_transcription: Optional[types.AudioTranscriptionConfig] = None
69
71
  """Input transcription for live agents with audio input from user."""
70
72
 
73
+ realtime_input_config: Optional[types.RealtimeInputConfig] = None
74
+ """Realtime input config for live agents with audio input from user."""
75
+
76
+ enable_affective_dialog: Optional[bool] = None
77
+ """If enabled, the model will detect emotions and adapt its responses accordingly."""
78
+
79
+ proactivity: Optional[types.ProactivityConfig] = None
80
+ """Configures the proactivity of the model. This allows the model to respond proactively to the input and to ignore irrelevant input."""
81
+
71
82
  max_llm_calls: int = 500
72
83
  """
73
84
  A limit on the total number of llm calls for a given run.
@@ -12,6 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ from __future__ import annotations
16
+
15
17
  from enum import Enum
16
18
  from typing import Any
17
19
  from typing import Dict
@@ -75,6 +77,8 @@ class OAuth2Auth(BaseModelWithConfig):
75
77
  auth_code: Optional[str] = None
76
78
  access_token: Optional[str] = None
77
79
  refresh_token: Optional[str] = None
80
+ expires_at: Optional[int] = None
81
+ expires_in: Optional[int] = None
78
82
 
79
83
 
80
84
  class ServiceAccountCredential(BaseModelWithConfig):
@@ -16,16 +16,13 @@ from __future__ import annotations
16
16
 
17
17
  from typing import TYPE_CHECKING
18
18
 
19
- from fastapi.openapi.models import OAuth2
20
19
  from fastapi.openapi.models import SecurityBase
21
20
 
22
21
  from .auth_credential import AuthCredential
23
- from .auth_credential import AuthCredentialTypes
24
- from .auth_credential import OAuth2Auth
25
22
  from .auth_schemes import AuthSchemeType
26
- from .auth_schemes import OAuthGrantType
27
23
  from .auth_schemes import OpenIdConnectWithConfig
28
24
  from .auth_tool import AuthConfig
25
+ from .exchanger.oauth2_credential_exchanger import OAuth2CredentialExchanger
29
26
 
30
27
  if TYPE_CHECKING:
31
28
  from ..sessions.state import State
@@ -33,86 +30,31 @@ if TYPE_CHECKING:
33
30
  try:
34
31
  from authlib.integrations.requests_client import OAuth2Session
35
32
 
36
- SUPPORT_TOKEN_EXCHANGE = True
33
+ AUTHLIB_AVIALABLE = True
37
34
  except ImportError:
38
- SUPPORT_TOKEN_EXCHANGE = False
35
+ AUTHLIB_AVIALABLE = False
39
36
 
40
37
 
41
38
  class AuthHandler:
39
+ """A handler that handles the auth flow in Agent Development Kit to help
40
+ orchestrate the credential request and response flow (e.g. OAuth flow)
41
+ This class should only be used by Agent Development Kit.
42
+ """
42
43
 
43
44
  def __init__(self, auth_config: AuthConfig):
44
45
  self.auth_config = auth_config
45
46
 
46
- def exchange_auth_token(
47
+ async def exchange_auth_token(
47
48
  self,
48
49
  ) -> AuthCredential:
49
- """Generates an auth token from the authorization response.
50
-
51
- Returns:
52
- An AuthCredential object containing the access token.
53
-
54
- Raises:
55
- ValueError: If the token endpoint is not configured in the auth
56
- scheme.
57
- AuthCredentialMissingError: If the access token cannot be retrieved
58
- from the token endpoint.
59
- """
60
- auth_scheme = self.auth_config.auth_scheme
61
- auth_credential = self.auth_config.exchanged_auth_credential
62
- if not SUPPORT_TOKEN_EXCHANGE:
63
- return auth_credential
64
- if isinstance(auth_scheme, OpenIdConnectWithConfig):
65
- if not hasattr(auth_scheme, "token_endpoint"):
66
- return self.auth_config.exchanged_auth_credential
67
- token_endpoint = auth_scheme.token_endpoint
68
- scopes = auth_scheme.scopes
69
- elif isinstance(auth_scheme, OAuth2):
70
- if (
71
- not auth_scheme.flows.authorizationCode
72
- or not auth_scheme.flows.authorizationCode.tokenUrl
73
- ):
74
- return self.auth_config.exchanged_auth_credential
75
- token_endpoint = auth_scheme.flows.authorizationCode.tokenUrl
76
- scopes = list(auth_scheme.flows.authorizationCode.scopes.keys())
77
- else:
78
- return self.auth_config.exchanged_auth_credential
79
-
80
- if (
81
- not auth_credential
82
- or not auth_credential.oauth2
83
- or not auth_credential.oauth2.client_id
84
- or not auth_credential.oauth2.client_secret
85
- or auth_credential.oauth2.access_token
86
- or auth_credential.oauth2.refresh_token
87
- ):
88
- return self.auth_config.exchanged_auth_credential
89
-
90
- client = OAuth2Session(
91
- auth_credential.oauth2.client_id,
92
- auth_credential.oauth2.client_secret,
93
- scope=" ".join(scopes),
94
- redirect_uri=auth_credential.oauth2.redirect_uri,
95
- state=auth_credential.oauth2.state,
50
+ exchanger = OAuth2CredentialExchanger()
51
+ return await exchanger.exchange(
52
+ self.auth_config.exchanged_auth_credential, self.auth_config.auth_scheme
96
53
  )
97
- tokens = client.fetch_token(
98
- token_endpoint,
99
- authorization_response=auth_credential.oauth2.auth_response_uri,
100
- code=auth_credential.oauth2.auth_code,
101
- grant_type=OAuthGrantType.AUTHORIZATION_CODE,
102
- )
103
-
104
- updated_credential = AuthCredential(
105
- auth_type=AuthCredentialTypes.OAUTH2,
106
- oauth2=OAuth2Auth(
107
- access_token=tokens.get("access_token"),
108
- refresh_token=tokens.get("refresh_token"),
109
- ),
110
- )
111
- return updated_credential
112
54
 
113
- def parse_and_store_auth_response(self, state: State) -> None:
55
+ async def parse_and_store_auth_response(self, state: State) -> None:
114
56
 
115
- credential_key = self.get_credential_key()
57
+ credential_key = "temp:" + self.auth_config.credential_key
116
58
 
117
59
  state[credential_key] = self.auth_config.exchanged_auth_credential
118
60
  if not isinstance(
@@ -123,14 +65,14 @@ class AuthHandler:
123
65
  ):
124
66
  return
125
67
 
126
- state[credential_key] = self.exchange_auth_token()
68
+ state[credential_key] = await self.exchange_auth_token()
127
69
 
128
70
  def _validate(self) -> None:
129
71
  if not self.auth_scheme:
130
72
  raise ValueError("auth_scheme is empty.")
131
73
 
132
74
  def get_auth_response(self, state: State) -> AuthCredential:
133
- credential_key = self.get_credential_key()
75
+ credential_key = "temp:" + self.auth_config.credential_key
134
76
  return state.get(credential_key, None)
135
77
 
136
78
  def generate_auth_request(self) -> AuthConfig:
@@ -192,29 +134,6 @@ class AuthHandler:
192
134
  exchanged_auth_credential=exchanged_credential,
193
135
  )
194
136
 
195
- def get_credential_key(self) -> str:
196
- """Generates a unique key for the given auth scheme and credential."""
197
- auth_scheme = self.auth_config.auth_scheme
198
- auth_credential = self.auth_config.raw_auth_credential
199
- if auth_scheme.model_extra:
200
- auth_scheme = auth_scheme.model_copy(deep=True)
201
- auth_scheme.model_extra.clear()
202
- scheme_name = (
203
- f"{auth_scheme.type_.name}_{hash(auth_scheme.model_dump_json())}"
204
- if auth_scheme
205
- else ""
206
- )
207
- if auth_credential.model_extra:
208
- auth_credential = auth_credential.model_copy(deep=True)
209
- auth_credential.model_extra.clear()
210
- credential_name = (
211
- f"{auth_credential.auth_type.value}_{hash(auth_credential.model_dump_json())}"
212
- if auth_credential
213
- else ""
214
- )
215
-
216
- return f"temp:adk_{scheme_name}_{credential_name}"
217
-
218
137
  def generate_auth_uri(
219
138
  self,
220
139
  ) -> AuthCredential:
@@ -227,6 +146,13 @@ class AuthHandler:
227
146
  ValueError: If the authorization endpoint is not configured in the auth
228
147
  scheme.
229
148
  """
149
+ if not AUTHLIB_AVIALABLE:
150
+ return (
151
+ self.auth_config.raw_auth_credential.model_copy(deep=True)
152
+ if self.auth_config.raw_auth_credential
153
+ else None
154
+ )
155
+
230
156
  auth_scheme = self.auth_config.auth_scheme
231
157
  auth_credential = self.auth_config.raw_auth_credential
232
158
 
@@ -67,9 +67,9 @@ class _AuthLlmRequestProcessor(BaseLlmRequestProcessor):
67
67
  # function call
68
68
  request_euc_function_call_ids.add(function_call_response.id)
69
69
  auth_config = AuthConfig.model_validate(function_call_response.response)
70
- AuthHandler(auth_config=auth_config).parse_and_store_auth_response(
71
- state=invocation_context.session.state
72
- )
70
+ await AuthHandler(
71
+ auth_config=auth_config
72
+ ).parse_and_store_auth_response(state=invocation_context.session.state)
73
73
  break
74
74
 
75
75
  if not request_euc_function_call_ids:
@@ -12,6 +12,12 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ from __future__ import annotations
16
+
17
+ from typing import Optional
18
+
19
+ from typing_extensions import deprecated
20
+
15
21
  from .auth_credential import AuthCredential
16
22
  from .auth_credential import BaseModelWithConfig
17
23
  from .auth_schemes import AuthScheme
@@ -43,6 +49,46 @@ class AuthConfig(BaseModelWithConfig):
43
49
  this field to guide the user through the OAuth2 flow and fill auth response in
44
50
  this field"""
45
51
 
52
+ credential_key: Optional[str] = None
53
+ """A user specified key used to load and save this credential in a credential
54
+ service.
55
+ """
56
+
57
+ def __init__(self, **data):
58
+ super().__init__(**data)
59
+ if self.credential_key:
60
+ return
61
+ self.credential_key = self.get_credential_key()
62
+
63
+ @deprecated("This method is deprecated. Use credential_key instead.")
64
+ def get_credential_key(self):
65
+ """Builds a hash key based on auth_scheme and raw_auth_credential used to
66
+ save / load this credential to / from a credentials service.
67
+ """
68
+
69
+ auth_scheme = self.auth_scheme
70
+
71
+ if auth_scheme.model_extra:
72
+ auth_scheme = auth_scheme.model_copy(deep=True)
73
+ auth_scheme.model_extra.clear()
74
+ scheme_name = (
75
+ f"{auth_scheme.type_.name}_{hash(auth_scheme.model_dump_json())}"
76
+ if auth_scheme
77
+ else ""
78
+ )
79
+
80
+ auth_credential = self.raw_auth_credential
81
+ if auth_credential and auth_credential.model_extra:
82
+ auth_credential = auth_credential.model_copy(deep=True)
83
+ auth_credential.model_extra.clear()
84
+ credential_name = (
85
+ f"{auth_credential.auth_type.value}_{hash(auth_credential.model_dump_json())}"
86
+ if auth_credential
87
+ else ""
88
+ )
89
+
90
+ return f"adk_{scheme_name}_{credential_name}"
91
+
46
92
 
47
93
  class AuthToolArguments(BaseModelWithConfig):
48
94
  """the arguments for the special long running function tool that is used to