google-adk 0.5.0__tar.gz → 1.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (208) hide show
  1. {google_adk-0.5.0 → google_adk-1.1.0}/PKG-INFO +18 -19
  2. {google_adk-0.5.0 → google_adk-1.1.0}/README.md +11 -14
  3. {google_adk-0.5.0 → google_adk-1.1.0}/pyproject.toml +20 -8
  4. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/base_agent.py +76 -30
  5. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/callback_context.py +2 -6
  6. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/llm_agent.py +122 -30
  7. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/loop_agent.py +1 -1
  8. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/parallel_agent.py +7 -0
  9. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/readonly_context.py +8 -0
  10. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/run_config.py +1 -1
  11. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/sequential_agent.py +31 -0
  12. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/transcription_entry.py +4 -2
  13. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/artifacts/gcs_artifact_service.py +1 -1
  14. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/artifacts/in_memory_artifact_service.py +1 -1
  15. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/auth/auth_credential.py +10 -2
  16. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/auth/auth_preprocessor.py +7 -1
  17. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/auth/auth_tool.py +3 -4
  18. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/agent_graph.py +5 -5
  19. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/browser/index.html +4 -4
  20. google_adk-0.5.0/src/google/adk/cli/browser/main-ULN5R5I5.js → google_adk-1.1.0/src/google/adk/cli/browser/main-PKDNKWJE.js +59 -60
  21. google_adk-1.1.0/src/google/adk/cli/browser/polyfills-B6TNHZQ6.js +17 -0
  22. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/cli.py +10 -9
  23. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/cli_deploy.py +7 -2
  24. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/cli_eval.py +109 -115
  25. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/cli_tools_click.py +179 -67
  26. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/fast_api.py +248 -197
  27. google_adk-1.1.0/src/google/adk/cli/utils/agent_loader.py +137 -0
  28. google_adk-1.1.0/src/google/adk/cli/utils/cleanup.py +40 -0
  29. google_adk-1.1.0/src/google/adk/cli/utils/common.py +23 -0
  30. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/utils/evals.py +83 -0
  31. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/utils/logs.py +8 -5
  32. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/code_executors/__init__.py +3 -1
  33. google_adk-1.1.0/src/google/adk/code_executors/built_in_code_executor.py +52 -0
  34. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/code_executors/code_execution_utils.py +2 -1
  35. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/code_executors/container_code_executor.py +0 -1
  36. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/code_executors/vertex_ai_code_executor.py +6 -8
  37. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/evaluation/__init__.py +1 -1
  38. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/evaluation/agent_evaluator.py +168 -128
  39. google_adk-1.1.0/src/google/adk/evaluation/eval_case.py +104 -0
  40. google_adk-1.1.0/src/google/adk/evaluation/eval_metrics.py +74 -0
  41. google_adk-1.1.0/src/google/adk/evaluation/eval_result.py +86 -0
  42. google_adk-1.1.0/src/google/adk/evaluation/eval_set.py +39 -0
  43. google_adk-1.1.0/src/google/adk/evaluation/eval_set_results_manager.py +47 -0
  44. google_adk-1.1.0/src/google/adk/evaluation/eval_sets_manager.py +43 -0
  45. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/evaluation/evaluation_generator.py +88 -113
  46. google_adk-1.1.0/src/google/adk/evaluation/evaluator.py +58 -0
  47. google_adk-1.1.0/src/google/adk/evaluation/local_eval_set_results_manager.py +113 -0
  48. google_adk-1.1.0/src/google/adk/evaluation/local_eval_sets_manager.py +264 -0
  49. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/evaluation/response_evaluator.py +106 -1
  50. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/evaluation/trajectory_evaluator.py +84 -2
  51. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/events/event.py +6 -1
  52. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/events/event_actions.py +6 -1
  53. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/examples/base_example_provider.py +1 -0
  54. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/examples/example_util.py +3 -2
  55. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/_code_execution.py +9 -1
  56. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/audio_transcriber.py +4 -3
  57. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/base_llm_flow.py +58 -21
  58. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/contents.py +3 -1
  59. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/functions.py +9 -8
  60. google_adk-1.1.0/src/google/adk/flows/llm_flows/instructions.py +86 -0
  61. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/single_flow.py +2 -2
  62. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/memory/__init__.py +1 -1
  63. google_adk-1.1.0/src/google/adk/memory/_utils.py +23 -0
  64. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/memory/base_memory_service.py +23 -21
  65. google_adk-1.1.0/src/google/adk/memory/in_memory_memory_service.py +94 -0
  66. google_adk-1.1.0/src/google/adk/memory/memory_entry.py +37 -0
  67. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/memory/vertex_ai_rag_memory_service.py +38 -15
  68. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/models/anthropic_llm.py +16 -9
  69. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/models/base_llm.py +2 -1
  70. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/models/base_llm_connection.py +2 -0
  71. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/models/gemini_llm_connection.py +11 -11
  72. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/models/google_llm.py +12 -2
  73. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/models/lite_llm.py +80 -23
  74. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/models/llm_response.py +16 -3
  75. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/models/registry.py +1 -1
  76. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/runners.py +98 -42
  77. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/sessions/__init__.py +1 -1
  78. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/sessions/_session_util.py +2 -1
  79. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/sessions/base_session_service.py +6 -33
  80. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/sessions/database_session_service.py +57 -67
  81. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/sessions/in_memory_session_service.py +106 -24
  82. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/sessions/session.py +3 -0
  83. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/sessions/vertex_ai_session_service.py +44 -51
  84. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/telemetry.py +7 -2
  85. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/__init__.py +4 -7
  86. google_adk-1.1.0/src/google/adk/tools/_memory_entry_utils.py +30 -0
  87. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/agent_tool.py +10 -10
  88. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/apihub_tool/apihub_toolset.py +55 -74
  89. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/apihub_tool/clients/apihub_client.py +10 -3
  90. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/apihub_tool/clients/secret_client.py +1 -0
  91. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/application_integration_tool/application_integration_toolset.py +111 -85
  92. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/application_integration_tool/clients/connections_client.py +28 -1
  93. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/application_integration_tool/clients/integration_client.py +7 -5
  94. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/application_integration_tool/integration_connector_tool.py +69 -26
  95. google_adk-1.1.0/src/google/adk/tools/base_toolset.py +96 -0
  96. google_adk-1.1.0/src/google/adk/tools/bigquery/__init__.py +28 -0
  97. google_adk-1.1.0/src/google/adk/tools/bigquery/bigquery_credentials.py +216 -0
  98. google_adk-1.1.0/src/google/adk/tools/bigquery/bigquery_tool.py +116 -0
  99. google_adk-0.5.0/src/google/adk/tools/built_in_code_execution_tool.py → google_adk-1.1.0/src/google/adk/tools/enterprise_search_tool.py +17 -11
  100. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/function_parameter_parse_util.py +9 -2
  101. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/function_tool.py +33 -3
  102. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/get_user_choice_tool.py +1 -0
  103. google_adk-1.1.0/src/google/adk/tools/google_api_tool/__init__.py +41 -0
  104. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/google_api_tool/google_api_tool.py +12 -6
  105. google_adk-0.5.0/src/google/adk/tools/google_api_tool/google_api_tool_set.py → google_adk-1.1.0/src/google/adk/tools/google_api_tool/google_api_toolset.py +57 -55
  106. google_adk-1.1.0/src/google/adk/tools/google_api_tool/google_api_toolsets.py +108 -0
  107. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/google_api_tool/googleapi_to_openapi_converter.py +40 -42
  108. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/google_search_tool.py +2 -2
  109. google_adk-1.1.0/src/google/adk/tools/langchain_tool.py +133 -0
  110. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/load_memory_tool.py +14 -5
  111. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/mcp_tool/__init__.py +3 -2
  112. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/mcp_tool/conversion_utils.py +6 -2
  113. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/mcp_tool/mcp_session_manager.py +80 -69
  114. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/mcp_tool/mcp_tool.py +35 -32
  115. google_adk-1.1.0/src/google/adk/tools/mcp_tool/mcp_toolset.py +171 -0
  116. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/base_credential_exchanger.py +1 -3
  117. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/service_account_exchanger.py +6 -7
  118. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/common/common.py +5 -1
  119. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/__init__.py +7 -2
  120. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_toolset.py +27 -7
  121. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py +36 -32
  122. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py +11 -1
  123. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/tool_auth_handler.py +1 -1
  124. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/preload_memory_tool.py +27 -18
  125. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/retrieval/__init__.py +1 -1
  126. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/retrieval/vertex_ai_rag_retrieval.py +1 -1
  127. google_adk-1.1.0/src/google/adk/tools/toolbox_toolset.py +107 -0
  128. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/transfer_to_agent_tool.py +0 -1
  129. google_adk-1.1.0/src/google/adk/utils/__init__.py +13 -0
  130. google_adk-0.5.0/src/google/adk/flows/llm_flows/instructions.py → google_adk-1.1.0/src/google/adk/utils/instructions_utils.py +49 -66
  131. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/version.py +1 -1
  132. google_adk-0.5.0/src/google/adk/agents/remote_agent.py +0 -50
  133. google_adk-0.5.0/src/google/adk/cli/browser/polyfills-FFHMD2TL.js +0 -18
  134. google_adk-0.5.0/src/google/adk/cli/fast_api.py.orig +0 -728
  135. google_adk-0.5.0/src/google/adk/memory/in_memory_memory_service.py +0 -62
  136. google_adk-0.5.0/src/google/adk/tools/google_api_tool/__init__.py +0 -87
  137. google_adk-0.5.0/src/google/adk/tools/google_api_tool/google_api_tool_sets.py +0 -112
  138. google_adk-0.5.0/src/google/adk/tools/langchain_tool.py +0 -86
  139. google_adk-0.5.0/src/google/adk/tools/mcp_tool/mcp_toolset.py +0 -266
  140. google_adk-0.5.0/src/google/adk/tools/toolbox_tool.py +0 -46
  141. {google_adk-0.5.0 → google_adk-1.1.0}/LICENSE +0 -0
  142. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/__init__.py +0 -0
  143. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/__init__.py +0 -0
  144. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/active_streaming_tool.py +0 -0
  145. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/invocation_context.py +0 -0
  146. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/langgraph_agent.py +0 -0
  147. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/agents/live_request_queue.py +0 -0
  148. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/artifacts/__init__.py +0 -0
  149. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/artifacts/base_artifact_service.py +0 -0
  150. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/auth/__init__.py +0 -0
  151. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/auth/auth_handler.py +0 -0
  152. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/auth/auth_schemes.py +0 -0
  153. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/__init__.py +0 -0
  154. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/__main__.py +0 -0
  155. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/browser/adk_favicon.svg +0 -0
  156. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/browser/assets/audio-processor.js +0 -0
  157. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/browser/assets/config/runtime-config.json +0 -0
  158. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/browser/styles-4VDSPQ37.css +0 -0
  159. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/cli_create.py +0 -0
  160. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/utils/__init__.py +0 -0
  161. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/cli/utils/envs.py +0 -0
  162. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/code_executors/base_code_executor.py +0 -0
  163. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/code_executors/code_executor_context.py +0 -0
  164. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/code_executors/unsafe_local_code_executor.py +0 -0
  165. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/evaluation/evaluation_constants.py +0 -0
  166. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/events/__init__.py +0 -0
  167. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/examples/__init__.py +0 -0
  168. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/examples/example.py +0 -0
  169. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/examples/vertex_ai_example_store.py +0 -0
  170. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/__init__.py +0 -0
  171. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/__init__.py +0 -0
  172. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/_base_llm_processor.py +0 -0
  173. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/_nl_planning.py +0 -0
  174. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/agent_transfer.py +0 -0
  175. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/auto_flow.py +0 -0
  176. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/basic.py +0 -0
  177. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/flows/llm_flows/identity.py +0 -0
  178. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/models/__init__.py +0 -0
  179. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/models/llm_request.py +0 -0
  180. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/planners/__init__.py +0 -0
  181. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/planners/base_planner.py +0 -0
  182. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/planners/built_in_planner.py +0 -0
  183. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/planners/plan_re_act_planner.py +0 -0
  184. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/sessions/state.py +0 -0
  185. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/_automatic_function_calling_util.py +0 -0
  186. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/apihub_tool/__init__.py +0 -0
  187. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/apihub_tool/clients/__init__.py +0 -0
  188. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/application_integration_tool/__init__.py +0 -0
  189. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/base_tool.py +0 -0
  190. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/crewai_tool.py +0 -0
  191. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/example_tool.py +0 -0
  192. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/exit_loop_tool.py +0 -0
  193. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/load_artifacts_tool.py +0 -0
  194. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/load_web_page.py +0 -0
  195. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/long_running_tool.py +0 -0
  196. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/__init__.py +0 -0
  197. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/auth/__init__.py +0 -0
  198. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/auth/auth_helpers.py +0 -0
  199. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/__init__.py +0 -0
  200. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/auto_auth_credential_exchanger.py +0 -0
  201. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py +0 -0
  202. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/common/__init__.py +0 -0
  203. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/openapi_tool/openapi_spec_parser/openapi_spec_parser.py +0 -0
  204. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/retrieval/base_retrieval_tool.py +0 -0
  205. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/retrieval/files_retrieval.py +0 -0
  206. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/retrieval/llama_index_retrieval.py +0 -0
  207. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/tool_context.py +0 -0
  208. {google_adk-0.5.0 → google_adk-1.1.0}/src/google/adk/tools/vertex_ai_search_tool.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-adk
3
- Version: 0.5.0
3
+ Version: 1.1.0
4
4
  Summary: Agent Development Kit
5
5
  Author-email: Google LLC <googleapis-packages@google.com>
6
6
  Requires-Python: >=3.9
@@ -11,10 +11,10 @@ Classifier: Intended Audience :: Science/Research
11
11
  Classifier: Programming Language :: Python
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.13
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: 3.11
17
14
  Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Operating System :: OS Independent
19
19
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
20
  Classifier: License :: OSI Approved :: Apache Software License
@@ -27,7 +27,7 @@ Requires-Dist: google-cloud-aiplatform>=1.87.0
27
27
  Requires-Dist: google-cloud-secret-manager>=2.22.0
28
28
  Requires-Dist: google-cloud-speech>=2.30.0
29
29
  Requires-Dist: google-cloud-storage>=2.18.0, <3.0.0
30
- Requires-Dist: google-genai>=1.12.1
30
+ Requires-Dist: google-genai>=1.14.0
31
31
  Requires-Dist: graphviz>=0.20.2
32
32
  Requires-Dist: mcp>=1.5.0;python_version>='3.10'
33
33
  Requires-Dist: opentelemetry-api>=1.31.0
@@ -43,6 +43,7 @@ Requires-Dist: flit>=3.10.0 ; extra == "dev"
43
43
  Requires-Dist: isort>=6.0.0 ; extra == "dev"
44
44
  Requires-Dist: pyink>=24.10.0 ; extra == "dev"
45
45
  Requires-Dist: pylint>=2.6.0 ; extra == "dev"
46
+ Requires-Dist: mypy>=1.15.0 ; extra == "dev"
46
47
  Requires-Dist: autodoc_pydantic ; extra == "docs"
47
48
  Requires-Dist: furo ; extra == "docs"
48
49
  Requires-Dist: myst-parser ; extra == "docs"
@@ -60,6 +61,7 @@ Requires-Dist: langgraph>=0.2.60 ; extra == "extensions"
60
61
  Requires-Dist: litellm>=1.63.11 ; extra == "extensions"
61
62
  Requires-Dist: llama-index-readers-file>=0.4.0 ; extra == "extensions"
62
63
  Requires-Dist: lxml>=5.3.0 ; extra == "extensions"
64
+ Requires-Dist: toolbox-core>=0.1.0 ; extra == "extensions"
63
65
  Requires-Dist: anthropic>=0.43.0 ; extra == "test"
64
66
  Requires-Dist: langchain-community>=0.3.17 ; extra == "test"
65
67
  Requires-Dist: langgraph>=0.2.60 ; extra == "test"
@@ -94,8 +96,10 @@ Provides-Extra: test
94
96
  </h3>
95
97
  <h3 align="center">
96
98
  Important Links:
97
- <a href="https://google.github.io/adk-docs/">Docs</a> &
98
- <a href="https://github.com/google/adk-samples">Samples</a>.
99
+ <a href="https://google.github.io/adk-docs/">Docs</a>,
100
+ <a href="https://github.com/google/adk-samples">Samples</a>,
101
+ <a href="https://github.com/google/adk-java">Java ADK</a> &
102
+ <a href="https://github.com/google/adk-web">ADK Web</a>.
99
103
  </h3>
100
104
  </html>
101
105
 
@@ -119,6 +123,12 @@ Agent Development Kit (ADK) is a flexible and modular framework for developing a
119
123
  - **Deploy Anywhere**: Easily containerize and deploy agents on Cloud Run or
120
124
  scale seamlessly with Vertex AI Agent Engine.
121
125
 
126
+ ## 🤖 Agent2Agent (A2A) Protocol and ADK Integration
127
+
128
+ For remote agent-to-agent communication, ADK integrates with the
129
+ [A2A protocol](https://github.com/google/A2A/).
130
+ See this [example](https://github.com/google/A2A/tree/main/samples/python/agents/google_adk)
131
+ for how they can work together.
122
132
 
123
133
  ## 🚀 Installation
124
134
 
@@ -204,16 +214,9 @@ adk eval \
204
214
  samples_for_testing/hello_world/hello_world_eval_set_001.evalset.json
205
215
  ```
206
216
 
207
- ## 🤖 A2A and ADK integration
208
-
209
- For remote agent-to-agent communication, ADK integrates with the
210
- [A2A protocol](https://github.com/google/A2A/).
211
- See this [example](https://github.com/google/A2A/tree/main/samples/python/agents/google_adk)
212
- for how they can work together.
213
-
214
217
  ## 🤝 Contributing
215
218
 
216
- We welcome contributions from the community! Whether it's bug reports, feature requests, documentation improvements, or code contributions, please see our
219
+ We welcome contributions from the community! Whether it's bug reports, feature requests, documentation improvements, or code contributions, please see our
217
220
  - [General contribution guideline and flow](https://google.github.io/adk-docs/contributing-guide/#questions).
218
221
  - Then if you want to contribute code, please read [Code Contributing Guidelines](./CONTRIBUTING.md) to get started.
219
222
 
@@ -221,10 +224,6 @@ We welcome contributions from the community! Whether it's bug reports, feature r
221
224
 
222
225
  This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
223
226
 
224
- ## Preview
225
-
226
- This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the [Service Specific Terms](https://cloud.google.com/terms/service-terms#1). Pre-GA features are available "as is" and might have limited support. For more information, see the [launch stage descriptions](https://cloud.google.com/products?hl=en#product-launch-stages).
227
-
228
227
  ---
229
228
 
230
229
  *Happy Agent Building!*
@@ -13,8 +13,10 @@
13
13
  </h3>
14
14
  <h3 align="center">
15
15
  Important Links:
16
- <a href="https://google.github.io/adk-docs/">Docs</a> &
17
- <a href="https://github.com/google/adk-samples">Samples</a>.
16
+ <a href="https://google.github.io/adk-docs/">Docs</a>,
17
+ <a href="https://github.com/google/adk-samples">Samples</a>,
18
+ <a href="https://github.com/google/adk-java">Java ADK</a> &
19
+ <a href="https://github.com/google/adk-web">ADK Web</a>.
18
20
  </h3>
19
21
  </html>
20
22
 
@@ -38,6 +40,12 @@ Agent Development Kit (ADK) is a flexible and modular framework for developing a
38
40
  - **Deploy Anywhere**: Easily containerize and deploy agents on Cloud Run or
39
41
  scale seamlessly with Vertex AI Agent Engine.
40
42
 
43
+ ## 🤖 Agent2Agent (A2A) Protocol and ADK Integration
44
+
45
+ For remote agent-to-agent communication, ADK integrates with the
46
+ [A2A protocol](https://github.com/google/A2A/).
47
+ See this [example](https://github.com/google/A2A/tree/main/samples/python/agents/google_adk)
48
+ for how they can work together.
41
49
 
42
50
  ## 🚀 Installation
43
51
 
@@ -123,16 +131,9 @@ adk eval \
123
131
  samples_for_testing/hello_world/hello_world_eval_set_001.evalset.json
124
132
  ```
125
133
 
126
- ## 🤖 A2A and ADK integration
127
-
128
- For remote agent-to-agent communication, ADK integrates with the
129
- [A2A protocol](https://github.com/google/A2A/).
130
- See this [example](https://github.com/google/A2A/tree/main/samples/python/agents/google_adk)
131
- for how they can work together.
132
-
133
134
  ## 🤝 Contributing
134
135
 
135
- We welcome contributions from the community! Whether it's bug reports, feature requests, documentation improvements, or code contributions, please see our
136
+ We welcome contributions from the community! Whether it's bug reports, feature requests, documentation improvements, or code contributions, please see our
136
137
  - [General contribution guideline and flow](https://google.github.io/adk-docs/contributing-guide/#questions).
137
138
  - Then if you want to contribute code, please read [Code Contributing Guidelines](./CONTRIBUTING.md) to get started.
138
139
 
@@ -140,10 +141,6 @@ We welcome contributions from the community! Whether it's bug reports, feature r
140
141
 
141
142
  This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
142
143
 
143
- ## Preview
144
-
145
- This feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the [Service Specific Terms](https://cloud.google.com/terms/service-terms#1). Pre-GA features are available "as is" and might have limited support. For more information, see the [launch stage descriptions](https://cloud.google.com/products?hl=en#product-launch-stages).
146
-
147
144
  ---
148
145
 
149
146
  *Happy Agent Building!*
@@ -15,10 +15,10 @@ classifiers = [ # List of https://pypi.org/classifiers/
15
15
  "Programming Language :: Python",
16
16
  "Programming Language :: Python :: 3",
17
17
  "Programming Language :: Python :: 3.9",
18
- "Programming Language :: Python :: 3.13",
19
- "Programming Language :: Python :: 3.12",
20
- "Programming Language :: Python :: 3.11",
21
18
  "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
22
  "Operating System :: OS Independent",
23
23
  "Topic :: Software Development :: Libraries :: Python Modules",
24
24
  "License :: OSI Approved :: Apache Software License",
@@ -31,9 +31,9 @@ dependencies = [
31
31
  "google-api-python-client>=2.157.0", # Google API client discovery
32
32
  "google-cloud-aiplatform>=1.87.0", # For VertexAI integrations, e.g. example store.
33
33
  "google-cloud-secret-manager>=2.22.0", # Fetching secrets in RestAPI Tool
34
- "google-cloud-speech>=2.30.0", # For Audo Transcription
34
+ "google-cloud-speech>=2.30.0", # For Audio Transcription
35
35
  "google-cloud-storage>=2.18.0, <3.0.0", # For GCS Artifact service
36
- "google-genai>=1.12.1", # Google GenAI SDK
36
+ "google-genai>=1.14.0", # Google GenAI SDK
37
37
  "graphviz>=0.20.2", # Graphviz for graph rendering
38
38
  "mcp>=1.5.0;python_version>='3.10'", # For MCP Toolset
39
39
  "opentelemetry-api>=1.31.0", # OpenTelemetry
@@ -66,6 +66,7 @@ dev = [
66
66
  "isort>=6.0.0",
67
67
  "pyink>=24.10.0",
68
68
  "pylint>=2.6.0",
69
+ "mypy>=1.15.0",
69
70
  # go/keep-sorted end
70
71
  ]
71
72
 
@@ -83,7 +84,8 @@ test = [
83
84
  "langchain-community>=0.3.17",
84
85
  "langgraph>=0.2.60", # For LangGraphAgent
85
86
  "litellm>=1.63.11", # For LiteLLM tests
86
- "llama-index-readers-file>=0.4.0", # for retrieval tests
87
+ "llama-index-readers-file>=0.4.0", # For retrieval tests
88
+
87
89
  "pytest-asyncio>=0.25.0",
88
90
  "pytest-mock>=3.14.0",
89
91
  "pytest-xdist>=3.6.1",
@@ -108,8 +110,9 @@ extensions = [
108
110
  "docker>=7.0.0", # For ContainerCodeExecutor
109
111
  "langgraph>=0.2.60", # For LangGraphAgent
110
112
  "litellm>=1.63.11", # For LiteLLM support
111
- "llama-index-readers-file>=0.4.0", # for retrieval usings LlamaIndex.
113
+ "llama-index-readers-file>=0.4.0", # For retrieval using LlamaIndex.
112
114
  "lxml>=5.3.0", # For load_web_page tool.
115
+ "toolbox-core>=0.1.0", # For tools.toolbox_toolset.ToolboxToolset
113
116
  ]
114
117
 
115
118
 
@@ -146,9 +149,18 @@ name = "google.adk"
146
149
  [tool.isort]
147
150
  profile = "google"
148
151
  single_line_exclusions = []
149
-
152
+ known_third_party = ["google.adk"]
150
153
 
151
154
  [tool.pytest.ini_options]
152
155
  testpaths = ["tests"]
153
156
  asyncio_default_fixture_loop_scope = "function"
154
157
  asyncio_mode = "auto"
158
+
159
+ [tool.mypy]
160
+ python_version = "3.9"
161
+ exclude = "tests/"
162
+ plugins = ["pydantic.mypy"]
163
+ # Start with non-strict mode, and swtich to strict mode later.
164
+ # strict = true
165
+ disable_error_code = ["import-not-found", "import-untyped", "unused-ignore"]
166
+ follow_imports = "skip"
@@ -15,12 +15,14 @@
15
15
  from __future__ import annotations
16
16
 
17
17
  import inspect
18
- from typing import Any, Awaitable, Union
18
+ from typing import Any
19
19
  from typing import AsyncGenerator
20
+ from typing import Awaitable
20
21
  from typing import Callable
21
22
  from typing import final
22
23
  from typing import Optional
23
24
  from typing import TYPE_CHECKING
25
+ from typing import Union
24
26
 
25
27
  from google.genai import types
26
28
  from opentelemetry import trace
@@ -29,6 +31,7 @@ from pydantic import ConfigDict
29
31
  from pydantic import Field
30
32
  from pydantic import field_validator
31
33
  from typing_extensions import override
34
+ from typing_extensions import TypeAlias
32
35
 
33
36
  from ..events.event import Event
34
37
  from .callback_context import CallbackContext
@@ -38,14 +41,19 @@ if TYPE_CHECKING:
38
41
 
39
42
  tracer = trace.get_tracer('gcp.vertex.agent')
40
43
 
41
- BeforeAgentCallback = Callable[
44
+ _SingleAgentCallback: TypeAlias = Callable[
42
45
  [CallbackContext],
43
46
  Union[Awaitable[Optional[types.Content]], Optional[types.Content]],
44
47
  ]
45
48
 
46
- AfterAgentCallback = Callable[
47
- [CallbackContext],
48
- Union[Awaitable[Optional[types.Content]], Optional[types.Content]],
49
+ BeforeAgentCallback: TypeAlias = Union[
50
+ _SingleAgentCallback,
51
+ list[_SingleAgentCallback],
52
+ ]
53
+
54
+ AfterAgentCallback: TypeAlias = Union[
55
+ _SingleAgentCallback,
56
+ list[_SingleAgentCallback],
49
57
  ]
50
58
 
51
59
 
@@ -85,7 +93,10 @@ class BaseAgent(BaseModel):
85
93
  """The sub-agents of this agent."""
86
94
 
87
95
  before_agent_callback: Optional[BeforeAgentCallback] = None
88
- """Callback signature that is invoked before the agent run.
96
+ """Callback or list of callbacks to be invoked before the agent run.
97
+
98
+ When a list of callbacks is provided, the callbacks will be called in the
99
+ order they are listed until a callback does not return None.
89
100
 
90
101
  Args:
91
102
  callback_context: MUST be named 'callback_context' (enforced).
@@ -96,7 +107,10 @@ class BaseAgent(BaseModel):
96
107
  provided content will be returned to user.
97
108
  """
98
109
  after_agent_callback: Optional[AfterAgentCallback] = None
99
- """Callback signature that is invoked after the agent run.
110
+ """Callback or list of callbacks to be invoked after the agent run.
111
+
112
+ When a list of callbacks is provided, the callbacks will be called in the
113
+ order they are listed until a callback does not return None.
100
114
 
101
115
  Args:
102
116
  callback_context: MUST be named 'callback_context' (enforced).
@@ -236,6 +250,30 @@ class BaseAgent(BaseModel):
236
250
  invocation_context.branch = f'{parent_context.branch}.{self.name}'
237
251
  return invocation_context
238
252
 
253
+ @property
254
+ def canonical_before_agent_callbacks(self) -> list[_SingleAgentCallback]:
255
+ """The resolved self.before_agent_callback field as a list of _SingleAgentCallback.
256
+
257
+ This method is only for use by Agent Development Kit.
258
+ """
259
+ if not self.before_agent_callback:
260
+ return []
261
+ if isinstance(self.before_agent_callback, list):
262
+ return self.before_agent_callback
263
+ return [self.before_agent_callback]
264
+
265
+ @property
266
+ def canonical_after_agent_callbacks(self) -> list[_SingleAgentCallback]:
267
+ """The resolved self.after_agent_callback field as a list of _SingleAgentCallback.
268
+
269
+ This method is only for use by Agent Development Kit.
270
+ """
271
+ if not self.after_agent_callback:
272
+ return []
273
+ if isinstance(self.after_agent_callback, list):
274
+ return self.after_agent_callback
275
+ return [self.after_agent_callback]
276
+
239
277
  async def __handle_before_agent_callback(
240
278
  self, ctx: InvocationContext
241
279
  ) -> Optional[Event]:
@@ -246,27 +284,27 @@ class BaseAgent(BaseModel):
246
284
  """
247
285
  ret_event = None
248
286
 
249
- if not isinstance(self.before_agent_callback, Callable):
287
+ if not self.canonical_before_agent_callbacks:
250
288
  return ret_event
251
289
 
252
290
  callback_context = CallbackContext(ctx)
253
- before_agent_callback_content = self.before_agent_callback(
254
- callback_context=callback_context
255
- )
256
291
 
257
- if inspect.isawaitable(before_agent_callback_content):
258
- before_agent_callback_content = await before_agent_callback_content
259
-
260
- if before_agent_callback_content:
261
- ret_event = Event(
262
- invocation_id=ctx.invocation_id,
263
- author=self.name,
264
- branch=ctx.branch,
265
- content=before_agent_callback_content,
266
- actions=callback_context._event_actions,
292
+ for callback in self.canonical_before_agent_callbacks:
293
+ before_agent_callback_content = callback(
294
+ callback_context=callback_context
267
295
  )
268
- ctx.end_invocation = True
269
- return ret_event
296
+ if inspect.isawaitable(before_agent_callback_content):
297
+ before_agent_callback_content = await before_agent_callback_content
298
+ if before_agent_callback_content:
299
+ ret_event = Event(
300
+ invocation_id=ctx.invocation_id,
301
+ author=self.name,
302
+ branch=ctx.branch,
303
+ content=before_agent_callback_content,
304
+ actions=callback_context._event_actions,
305
+ )
306
+ ctx.end_invocation = True
307
+ return ret_event
270
308
 
271
309
  if callback_context.state.has_delta():
272
310
  ret_event = Event(
@@ -288,18 +326,26 @@ class BaseAgent(BaseModel):
288
326
  """
289
327
  ret_event = None
290
328
 
291
- if not isinstance(self.after_agent_callback, Callable):
329
+ if not self.canonical_after_agent_callbacks:
292
330
  return ret_event
293
331
 
294
332
  callback_context = CallbackContext(invocation_context)
295
- after_agent_callback_content = self.after_agent_callback(
296
- callback_context=callback_context
297
- )
298
333
 
299
- if inspect.isawaitable(after_agent_callback_content):
300
- after_agent_callback_content = await after_agent_callback_content
334
+ for callback in self.canonical_after_agent_callbacks:
335
+ after_agent_callback_content = callback(callback_context=callback_context)
336
+ if inspect.isawaitable(after_agent_callback_content):
337
+ after_agent_callback_content = await after_agent_callback_content
338
+ if after_agent_callback_content:
339
+ ret_event = Event(
340
+ invocation_id=invocation_context.invocation_id,
341
+ author=self.name,
342
+ branch=invocation_context.branch,
343
+ content=after_agent_callback_content,
344
+ actions=callback_context._event_actions,
345
+ )
346
+ return ret_event
301
347
 
302
- if after_agent_callback_content or callback_context.state.has_delta():
348
+ if callback_context.state.has_delta():
303
349
  ret_event = Event(
304
350
  invocation_id=invocation_context.invocation_id,
305
351
  author=self.name,
@@ -14,7 +14,8 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
- from typing import Optional, TYPE_CHECKING
17
+ from typing import Optional
18
+ from typing import TYPE_CHECKING
18
19
 
19
20
  from typing_extensions import override
20
21
 
@@ -60,11 +61,6 @@ class CallbackContext(ReadonlyContext):
60
61
  """
61
62
  return self._state
62
63
 
63
- @property
64
- def user_content(self) -> Optional[types.Content]:
65
- """The user content that started this invocation. READONLY field."""
66
- return self._invocation_context.user_content
67
-
68
64
  async def load_artifact(
69
65
  self, filename: str, version: Optional[int] = None
70
66
  ) -> Optional[types.Part]:
@@ -14,8 +14,15 @@
14
14
 
15
15
  from __future__ import annotations
16
16
 
17
+ import inspect
17
18
  import logging
18
- from typing import Any, AsyncGenerator, Awaitable, Callable, Literal, Optional, Union
19
+ from typing import Any
20
+ from typing import AsyncGenerator
21
+ from typing import Awaitable
22
+ from typing import Callable
23
+ from typing import Literal
24
+ from typing import Optional
25
+ from typing import Union
19
26
 
20
27
  from google.genai import types
21
28
  from pydantic import BaseModel
@@ -38,6 +45,7 @@ from ..models.llm_response import LlmResponse
38
45
  from ..models.registry import LLMRegistry
39
46
  from ..planners.base_planner import BasePlanner
40
47
  from ..tools.base_tool import BaseTool
48
+ from ..tools.base_toolset import BaseToolset
41
49
  from ..tools.function_tool import FunctionTool
42
50
  from ..tools.tool_context import ToolContext
43
51
  from .base_agent import BaseAgent
@@ -45,7 +53,7 @@ from .callback_context import CallbackContext
45
53
  from .invocation_context import InvocationContext
46
54
  from .readonly_context import ReadonlyContext
47
55
 
48
- logger = logging.getLogger(__name__)
56
+ logger = logging.getLogger('google_adk.' + __name__)
49
57
 
50
58
  _SingleBeforeModelCallback: TypeAlias = Callable[
51
59
  [CallbackContext, LlmRequest],
@@ -67,29 +75,43 @@ AfterModelCallback: TypeAlias = Union[
67
75
  list[_SingleAfterModelCallback],
68
76
  ]
69
77
 
70
- BeforeToolCallback: TypeAlias = Callable[
78
+ _SingleBeforeToolCallback: TypeAlias = Callable[
71
79
  [BaseTool, dict[str, Any], ToolContext],
72
80
  Union[Awaitable[Optional[dict]], Optional[dict]],
73
81
  ]
74
- AfterToolCallback: TypeAlias = Callable[
82
+
83
+ BeforeToolCallback: TypeAlias = Union[
84
+ _SingleBeforeToolCallback,
85
+ list[_SingleBeforeToolCallback],
86
+ ]
87
+
88
+ _SingleAfterToolCallback: TypeAlias = Callable[
75
89
  [BaseTool, dict[str, Any], ToolContext, dict],
76
90
  Union[Awaitable[Optional[dict]], Optional[dict]],
77
91
  ]
78
92
 
79
- InstructionProvider: TypeAlias = Callable[[ReadonlyContext], str]
93
+ AfterToolCallback: TypeAlias = Union[
94
+ _SingleAfterToolCallback,
95
+ list[_SingleAfterToolCallback],
96
+ ]
80
97
 
81
- ToolUnion: TypeAlias = Union[Callable, BaseTool]
98
+ InstructionProvider: TypeAlias = Callable[
99
+ [ReadonlyContext], Union[str, Awaitable[str]]
100
+ ]
101
+
102
+ ToolUnion: TypeAlias = Union[Callable, BaseTool, BaseToolset]
82
103
  ExamplesUnion = Union[list[Example], BaseExampleProvider]
83
104
 
84
105
 
85
- def _convert_tool_union_to_tool(
86
- tool_union: ToolUnion,
87
- ) -> BaseTool:
88
- return (
89
- tool_union
90
- if isinstance(tool_union, BaseTool)
91
- else FunctionTool(tool_union)
92
- )
106
+ async def _convert_tool_union_to_tools(
107
+ tool_union: ToolUnion, ctx: ReadonlyContext
108
+ ) -> list[BaseTool]:
109
+ if isinstance(tool_union, BaseTool):
110
+ return [tool_union]
111
+ if isinstance(tool_union, Callable):
112
+ return [FunctionTool(func=tool_union)]
113
+
114
+ return await tool_union.get_tools(ctx)
93
115
 
94
116
 
95
117
  class LlmAgent(BaseAgent):
@@ -128,7 +150,12 @@ class LlmAgent(BaseAgent):
128
150
 
129
151
  # LLM-based agent transfer configs - Start
130
152
  disallow_transfer_to_parent: bool = False
131
- """Disallows LLM-controlled transferring to the parent agent."""
153
+ """Disallows LLM-controlled transferring to the parent agent.
154
+
155
+ NOTE: Setting this as True also prevents this agent to continue reply to the
156
+ end-user. This behavior prevents one-way transfer, in which end-user may be
157
+ stuck with one agent that cannot transfer to other agents in the agent tree.
158
+ """
132
159
  disallow_transfer_to_peers: bool = False
133
160
  """Disallows LLM-controlled transferring to the peer agents."""
134
161
  # LLM-based agent transfer configs - End
@@ -173,8 +200,7 @@ class LlmAgent(BaseAgent):
173
200
 
174
201
  Check out available code executions in `google.adk.code_executor` package.
175
202
 
176
- NOTE: to use model's built-in code executor, don't set this field, add
177
- `google.adk.tools.built_in_code_execution` to tools instead.
203
+ NOTE: to use model's built-in code executor, use the `BuiltInCodeExecutor`.
178
204
  """
179
205
  # Advance features - End
180
206
 
@@ -214,7 +240,10 @@ class LlmAgent(BaseAgent):
214
240
  will be ignored and the provided content will be returned to user.
215
241
  """
216
242
  before_tool_callback: Optional[BeforeToolCallback] = None
217
- """Called before the tool is called.
243
+ """Callback or list of callbacks to be called before calling the tool.
244
+
245
+ When a list of callbacks is provided, the callbacks will be called in the
246
+ order they are listed until a callback does not return None.
218
247
 
219
248
  Args:
220
249
  tool: The tool to be called.
@@ -226,7 +255,10 @@ class LlmAgent(BaseAgent):
226
255
  the framework will skip calling the actual tool.
227
256
  """
228
257
  after_tool_callback: Optional[AfterToolCallback] = None
229
- """Called after the tool is called.
258
+ """Callback or list of callbacks to be called after calling the tool.
259
+
260
+ When a list of callbacks is provided, the callbacks will be called in the
261
+ order they are listed until a callback does not return None.
230
262
 
231
263
  Args:
232
264
  tool: The tool to be called.
@@ -275,33 +307,65 @@ class LlmAgent(BaseAgent):
275
307
  ancestor_agent = ancestor_agent.parent_agent
276
308
  raise ValueError(f'No model found for {self.name}.')
277
309
 
278
- def canonical_instruction(self, ctx: ReadonlyContext) -> str:
310
+ async def canonical_instruction(
311
+ self, ctx: ReadonlyContext
312
+ ) -> tuple[str, bool]:
279
313
  """The resolved self.instruction field to construct instruction for this agent.
280
314
 
281
315
  This method is only for use by Agent Development Kit.
316
+
317
+ Args:
318
+ ctx: The context to retrieve the session state.
319
+
320
+ Returns:
321
+ A tuple of (instruction, bypass_state_injection).
322
+ instruction: The resolved self.instruction field.
323
+ bypass_state_injection: Whether the instruction is based on
324
+ InstructionProvider.
282
325
  """
283
326
  if isinstance(self.instruction, str):
284
- return self.instruction
327
+ return self.instruction, False
285
328
  else:
286
- return self.instruction(ctx)
287
-
288
- def canonical_global_instruction(self, ctx: ReadonlyContext) -> str:
329
+ instruction = self.instruction(ctx)
330
+ if inspect.isawaitable(instruction):
331
+ instruction = await instruction
332
+ return instruction, True
333
+
334
+ async def canonical_global_instruction(
335
+ self, ctx: ReadonlyContext
336
+ ) -> tuple[str, bool]:
289
337
  """The resolved self.instruction field to construct global instruction.
290
338
 
291
339
  This method is only for use by Agent Development Kit.
340
+
341
+ Args:
342
+ ctx: The context to retrieve the session state.
343
+
344
+ Returns:
345
+ A tuple of (instruction, bypass_state_injection).
346
+ instruction: The resolved self.global_instruction field.
347
+ bypass_state_injection: Whether the instruction is based on
348
+ InstructionProvider.
292
349
  """
293
350
  if isinstance(self.global_instruction, str):
294
- return self.global_instruction
351
+ return self.global_instruction, False
295
352
  else:
296
- return self.global_instruction(ctx)
353
+ global_instruction = self.global_instruction(ctx)
354
+ if inspect.isawaitable(global_instruction):
355
+ global_instruction = await global_instruction
356
+ return global_instruction, True
297
357
 
298
- @property
299
- def canonical_tools(self) -> list[BaseTool]:
300
- """The resolved self.tools field as a list of BaseTool.
358
+ async def canonical_tools(
359
+ self, ctx: ReadonlyContext = None
360
+ ) -> list[BaseTool]:
361
+ """The resolved self.tools field as a list of BaseTool based on the context.
301
362
 
302
363
  This method is only for use by Agent Development Kit.
303
364
  """
304
- return [_convert_tool_union_to_tool(tool) for tool in self.tools]
365
+ resolved_tools = []
366
+ for tool_union in self.tools:
367
+ resolved_tools.extend(await _convert_tool_union_to_tools(tool_union, ctx))
368
+ return resolved_tools
305
369
 
306
370
  @property
307
371
  def canonical_before_model_callbacks(
@@ -329,6 +393,34 @@ class LlmAgent(BaseAgent):
329
393
  return self.after_model_callback
330
394
  return [self.after_model_callback]
331
395
 
396
+ @property
397
+ def canonical_before_tool_callbacks(
398
+ self,
399
+ ) -> list[BeforeToolCallback]:
400
+ """The resolved self.before_tool_callback field as a list of BeforeToolCallback.
401
+
402
+ This method is only for use by Agent Development Kit.
403
+ """
404
+ if not self.before_tool_callback:
405
+ return []
406
+ if isinstance(self.before_tool_callback, list):
407
+ return self.before_tool_callback
408
+ return [self.before_tool_callback]
409
+
410
+ @property
411
+ def canonical_after_tool_callbacks(
412
+ self,
413
+ ) -> list[AfterToolCallback]:
414
+ """The resolved self.after_tool_callback field as a list of AfterToolCallback.
415
+
416
+ This method is only for use by Agent Development Kit.
417
+ """
418
+ if not self.after_tool_callback:
419
+ return []
420
+ if isinstance(self.after_tool_callback, list):
421
+ return self.after_tool_callback
422
+ return [self.after_tool_callback]
423
+
332
424
  @property
333
425
  def _llm_flow(self) -> BaseLlmFlow:
334
426
  if (