google-adk 1.6.1__py3-none-any.whl → 1.7.0__py3-none-any.whl

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 (81) hide show
  1. google/adk/a2a/converters/event_converter.py +5 -85
  2. google/adk/a2a/executor/a2a_agent_executor.py +45 -16
  3. google/adk/agents/__init__.py +5 -0
  4. google/adk/agents/agent_config.py +46 -0
  5. google/adk/agents/base_agent.py +234 -41
  6. google/adk/agents/callback_context.py +41 -0
  7. google/adk/agents/common_configs.py +79 -0
  8. google/adk/agents/config_agent_utils.py +184 -0
  9. google/adk/agents/config_schemas/AgentConfig.json +544 -0
  10. google/adk/agents/invocation_context.py +5 -1
  11. google/adk/agents/llm_agent.py +190 -9
  12. google/adk/agents/loop_agent.py +29 -0
  13. google/adk/agents/parallel_agent.py +24 -3
  14. google/adk/agents/remote_a2a_agent.py +15 -3
  15. google/adk/agents/sequential_agent.py +22 -1
  16. google/adk/artifacts/gcs_artifact_service.py +24 -2
  17. google/adk/auth/auth_handler.py +3 -3
  18. google/adk/auth/credential_manager.py +23 -23
  19. google/adk/auth/credential_service/base_credential_service.py +6 -6
  20. google/adk/auth/credential_service/in_memory_credential_service.py +10 -8
  21. google/adk/auth/credential_service/session_state_credential_service.py +8 -8
  22. google/adk/auth/exchanger/oauth2_credential_exchanger.py +3 -3
  23. google/adk/auth/oauth2_credential_util.py +2 -2
  24. google/adk/auth/refresher/oauth2_credential_refresher.py +4 -4
  25. google/adk/cli/agent_graph.py +3 -1
  26. google/adk/cli/browser/index.html +1 -1
  27. google/adk/cli/browser/main-SRBSE46V.js +3914 -0
  28. google/adk/cli/browser/polyfills-B6TNHZQ6.js +17 -0
  29. google/adk/cli/fast_api.py +42 -2
  30. google/adk/cli/utils/agent_loader.py +35 -1
  31. google/adk/code_executors/base_code_executor.py +14 -19
  32. google/adk/code_executors/built_in_code_executor.py +4 -1
  33. google/adk/evaluation/base_eval_service.py +46 -2
  34. google/adk/evaluation/evaluation_generator.py +1 -1
  35. google/adk/evaluation/in_memory_eval_sets_manager.py +151 -0
  36. google/adk/evaluation/local_eval_service.py +389 -0
  37. google/adk/evaluation/local_eval_sets_manager.py +23 -8
  38. google/adk/flows/llm_flows/auto_flow.py +6 -11
  39. google/adk/flows/llm_flows/base_llm_flow.py +41 -23
  40. google/adk/flows/llm_flows/contents.py +16 -10
  41. google/adk/flows/llm_flows/functions.py +76 -33
  42. google/adk/memory/in_memory_memory_service.py +20 -14
  43. google/adk/models/anthropic_llm.py +44 -5
  44. google/adk/models/google_llm.py +11 -6
  45. google/adk/models/lite_llm.py +21 -4
  46. google/adk/plugins/__init__.py +17 -0
  47. google/adk/plugins/base_plugin.py +317 -0
  48. google/adk/plugins/plugin_manager.py +265 -0
  49. google/adk/runners.py +122 -18
  50. google/adk/sessions/database_session_service.py +26 -28
  51. google/adk/sessions/vertex_ai_session_service.py +14 -7
  52. google/adk/tools/agent_tool.py +1 -0
  53. google/adk/tools/apihub_tool/apihub_toolset.py +38 -39
  54. google/adk/tools/application_integration_tool/application_integration_toolset.py +35 -37
  55. google/adk/tools/application_integration_tool/integration_connector_tool.py +2 -3
  56. google/adk/tools/base_tool.py +9 -9
  57. google/adk/tools/base_toolset.py +7 -5
  58. google/adk/tools/bigquery/__init__.py +3 -3
  59. google/adk/tools/enterprise_search_tool.py +4 -2
  60. google/adk/tools/google_api_tool/google_api_tool.py +16 -1
  61. google/adk/tools/google_api_tool/google_api_toolset.py +9 -7
  62. google/adk/tools/google_api_tool/google_api_toolsets.py +41 -20
  63. google/adk/tools/google_search_tool.py +4 -2
  64. google/adk/tools/langchain_tool.py +2 -3
  65. google/adk/tools/long_running_tool.py +21 -0
  66. google/adk/tools/mcp_tool/mcp_toolset.py +27 -28
  67. google/adk/tools/openapi_tool/openapi_spec_parser/openapi_toolset.py +8 -8
  68. google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py +4 -6
  69. google/adk/tools/retrieval/vertex_ai_rag_retrieval.py +3 -2
  70. google/adk/tools/tool_context.py +0 -10
  71. google/adk/tools/url_context_tool.py +4 -2
  72. google/adk/tools/vertex_ai_search_tool.py +4 -2
  73. google/adk/utils/model_name_utils.py +90 -0
  74. google/adk/version.py +1 -1
  75. {google_adk-1.6.1.dist-info → google_adk-1.7.0.dist-info}/METADATA +2 -2
  76. {google_adk-1.6.1.dist-info → google_adk-1.7.0.dist-info}/RECORD +79 -69
  77. google/adk/cli/browser/main-RXDVX3K6.js +0 -3914
  78. google/adk/cli/browser/polyfills-FFHMD2TL.js +0 -17
  79. {google_adk-1.6.1.dist-info → google_adk-1.7.0.dist-info}/WHEEL +0 -0
  80. {google_adk-1.6.1.dist-info → google_adk-1.7.0.dist-info}/entry_points.txt +0 -0
  81. {google_adk-1.6.1.dist-info → google_adk-1.7.0.dist-info}/licenses/LICENSE +0 -0
@@ -18,7 +18,7 @@ from typing import Optional
18
18
 
19
19
  from typing_extensions import override
20
20
 
21
- from ...tools.tool_context import ToolContext
21
+ from ...agents.callback_context import CallbackContext
22
22
  from ...utils.feature_decorator import experimental
23
23
  from ..auth_credential import AuthCredential
24
24
  from ..auth_tool import AuthConfig
@@ -37,25 +37,27 @@ class InMemoryCredentialService(BaseCredentialService):
37
37
  async def load_credential(
38
38
  self,
39
39
  auth_config: AuthConfig,
40
- tool_context: ToolContext,
40
+ callback_context: CallbackContext,
41
41
  ) -> Optional[AuthCredential]:
42
- credential_bucket = self._get_bucket_for_current_context(tool_context)
42
+ credential_bucket = self._get_bucket_for_current_context(callback_context)
43
43
  return credential_bucket.get(auth_config.credential_key)
44
44
 
45
45
  @override
46
46
  async def save_credential(
47
47
  self,
48
48
  auth_config: AuthConfig,
49
- tool_context: ToolContext,
49
+ callback_context: CallbackContext,
50
50
  ) -> None:
51
- credential_bucket = self._get_bucket_for_current_context(tool_context)
51
+ credential_bucket = self._get_bucket_for_current_context(callback_context)
52
52
  credential_bucket[auth_config.credential_key] = (
53
53
  auth_config.exchanged_auth_credential
54
54
  )
55
55
 
56
- def _get_bucket_for_current_context(self, tool_context: ToolContext) -> str:
57
- app_name = tool_context._invocation_context.app_name
58
- user_id = tool_context._invocation_context.user_id
56
+ def _get_bucket_for_current_context(
57
+ self, callback_context: CallbackContext
58
+ ) -> str:
59
+ app_name = callback_context._invocation_context.app_name
60
+ user_id = callback_context._invocation_context.user_id
59
61
 
60
62
  if app_name not in self._credentials:
61
63
  self._credentials[app_name] = {}
@@ -18,7 +18,7 @@ from typing import Optional
18
18
 
19
19
  from typing_extensions import override
20
20
 
21
- from ...tools.tool_context import ToolContext
21
+ from ...agents.callback_context import CallbackContext
22
22
  from ...utils.feature_decorator import experimental
23
23
  from ..auth_credential import AuthCredential
24
24
  from ..auth_tool import AuthConfig
@@ -36,10 +36,10 @@ class SessionStateCredentialService(BaseCredentialService):
36
36
  async def load_credential(
37
37
  self,
38
38
  auth_config: AuthConfig,
39
- tool_context: ToolContext,
39
+ callback_context: CallbackContext,
40
40
  ) -> Optional[AuthCredential]:
41
41
  """
42
- Loads the credential by auth config and current tool context from the
42
+ Loads the credential by auth config and current callback context from the
43
43
  backend credential store.
44
44
 
45
45
  Args:
@@ -47,20 +47,20 @@ class SessionStateCredentialService(BaseCredentialService):
47
47
  credential information. auth_config.get_credential_key will be used to
48
48
  build the key to load the credential.
49
49
 
50
- tool_context: The context of the current invocation when the tool is
50
+ callback_context: The context of the current invocation when the tool is
51
51
  trying to load the credential.
52
52
 
53
53
  Returns:
54
54
  Optional[AuthCredential]: the credential saved in the store.
55
55
 
56
56
  """
57
- return tool_context.state.get(auth_config.credential_key)
57
+ return callback_context.state.get(auth_config.credential_key)
58
58
 
59
59
  @override
60
60
  async def save_credential(
61
61
  self,
62
62
  auth_config: AuthConfig,
63
- tool_context: ToolContext,
63
+ callback_context: CallbackContext,
64
64
  ) -> None:
65
65
  """
66
66
  Saves the exchanged_auth_credential in auth config to the backend credential
@@ -71,13 +71,13 @@ class SessionStateCredentialService(BaseCredentialService):
71
71
  credential information. auth_config.get_credential_key will be used to
72
72
  build the key to save the credential.
73
73
 
74
- tool_context: The context of the current invocation when the tool is
74
+ callback_context: The context of the current invocation when the tool is
75
75
  trying to save the credential.
76
76
 
77
77
  Returns:
78
78
  None
79
79
  """
80
80
 
81
- tool_context.state[auth_config.credential_key] = (
81
+ callback_context.state[auth_config.credential_key] = (
82
82
  auth_config.exchanged_auth_credential
83
83
  )
@@ -33,9 +33,9 @@ from .base_credential_exchanger import CredentialExchangError
33
33
  try:
34
34
  from authlib.integrations.requests_client import OAuth2Session
35
35
 
36
- AUTHLIB_AVIALABLE = True
36
+ AUTHLIB_AVAILABLE = True
37
37
  except ImportError:
38
- AUTHLIB_AVIALABLE = False
38
+ AUTHLIB_AVAILABLE = False
39
39
 
40
40
  logger = logging.getLogger("google_adk." + __name__)
41
41
 
@@ -68,7 +68,7 @@ class OAuth2CredentialExchanger(BaseCredentialExchanger):
68
68
  "auth_scheme is required for OAuth2 credential exchange"
69
69
  )
70
70
 
71
- if not AUTHLIB_AVIALABLE:
71
+ if not AUTHLIB_AVAILABLE:
72
72
  # If authlib is not available, we cannot exchange the credential.
73
73
  # We return the original credential without exchange.
74
74
  # The client using this tool can decide to exchange the credential
@@ -29,9 +29,9 @@ try:
29
29
  from authlib.integrations.requests_client import OAuth2Session
30
30
  from authlib.oauth2.rfc6749 import OAuth2Token
31
31
 
32
- AUTHLIB_AVIALABLE = True
32
+ AUTHLIB_AVAILABLE = True
33
33
  except ImportError:
34
- AUTHLIB_AVIALABLE = False
34
+ AUTHLIB_AVAILABLE = False
35
35
 
36
36
 
37
37
  logger = logging.getLogger("google_adk." + __name__)
@@ -34,9 +34,9 @@ from .base_credential_refresher import BaseCredentialRefresher
34
34
  try:
35
35
  from authlib.oauth2.rfc6749 import OAuth2Token
36
36
 
37
- AUTHLIB_AVIALABLE = True
37
+ AUTHLIB_AVAILABLE = True
38
38
  except ImportError:
39
- AUTHLIB_AVIALABLE = False
39
+ AUTHLIB_AVAILABLE = False
40
40
 
41
41
  logger = logging.getLogger("google_adk." + __name__)
42
42
 
@@ -63,7 +63,7 @@ class OAuth2CredentialRefresher(BaseCredentialRefresher):
63
63
 
64
64
  # Handle regular OAuth2 credentials
65
65
  if auth_credential.oauth2:
66
- if not AUTHLIB_AVIALABLE:
66
+ if not AUTHLIB_AVAILABLE:
67
67
  return False
68
68
 
69
69
  return OAuth2Token({
@@ -93,7 +93,7 @@ class OAuth2CredentialRefresher(BaseCredentialRefresher):
93
93
 
94
94
  # Handle regular OAuth2 credentials
95
95
  if auth_credential.oauth2 and auth_scheme:
96
- if not AUTHLIB_AVIALABLE:
96
+ if not AUTHLIB_AVAILABLE:
97
97
  return auth_credential
98
98
 
99
99
  if not auth_credential.oauth2:
@@ -284,7 +284,9 @@ async def build_graph(
284
284
 
285
285
  async def get_agent_graph(root_agent, highlights_pairs, image=False):
286
286
  print('build graph')
287
- graph = graphviz.Digraph(graph_attr={'rankdir': 'LR', 'bgcolor': '#333537'})
287
+ graph = graphviz.Digraph(
288
+ graph_attr={'rankdir': 'LR', 'bgcolor': '#333537'}, strict=True
289
+ )
288
290
  await build_graph(graph, root_agent, highlights_pairs)
289
291
  if image:
290
292
  return graph.pipe(format='png')
@@ -30,5 +30,5 @@
30
30
  <style>html{color-scheme:dark}html{--mat-sys-background:light-dark(#fcf9f8, #131314);--mat-sys-error:light-dark(#ba1a1a, #ffb4ab);--mat-sys-error-container:light-dark(#ffdad6, #93000a);--mat-sys-inverse-on-surface:light-dark(#f3f0f0, #313030);--mat-sys-inverse-primary:light-dark(#c1c7cd, #595f65);--mat-sys-inverse-surface:light-dark(#313030, #e5e2e2);--mat-sys-on-background:light-dark(#1c1b1c, #e5e2e2);--mat-sys-on-error:light-dark(#ffffff, #690005);--mat-sys-on-error-container:light-dark(#410002, #ffdad6);--mat-sys-on-primary:light-dark(#ffffff, #2b3136);--mat-sys-on-primary-container:light-dark(#161c21, #dde3e9);--mat-sys-on-primary-fixed:light-dark(#161c21, #161c21);--mat-sys-on-primary-fixed-variant:light-dark(#41474d, #41474d);--mat-sys-on-secondary:light-dark(#ffffff, #003061);--mat-sys-on-secondary-container:light-dark(#001b3c, #d5e3ff);--mat-sys-on-secondary-fixed:light-dark(#001b3c, #001b3c);--mat-sys-on-secondary-fixed-variant:light-dark(#0f4784, #0f4784);--mat-sys-on-surface:light-dark(#1c1b1c, #e5e2e2);--mat-sys-on-surface-variant:light-dark(#44474a, #e1e2e6);--mat-sys-on-tertiary:light-dark(#ffffff, #2b3136);--mat-sys-on-tertiary-container:light-dark(#161c21, #dde3e9);--mat-sys-on-tertiary-fixed:light-dark(#161c21, #161c21);--mat-sys-on-tertiary-fixed-variant:light-dark(#41474d, #41474d);--mat-sys-outline:light-dark(#74777b, #8e9194);--mat-sys-outline-variant:light-dark(#c4c7ca, #44474a);--mat-sys-primary:light-dark(#595f65, #c1c7cd);--mat-sys-primary-container:light-dark(#dde3e9, #41474d);--mat-sys-primary-fixed:light-dark(#dde3e9, #dde3e9);--mat-sys-primary-fixed-dim:light-dark(#c1c7cd, #c1c7cd);--mat-sys-scrim:light-dark(#000000, #000000);--mat-sys-secondary:light-dark(#305f9d, #a7c8ff);--mat-sys-secondary-container:light-dark(#d5e3ff, #0f4784);--mat-sys-secondary-fixed:light-dark(#d5e3ff, #d5e3ff);--mat-sys-secondary-fixed-dim:light-dark(#a7c8ff, #a7c8ff);--mat-sys-shadow:light-dark(#000000, #000000);--mat-sys-surface:light-dark(#fcf9f8, #131314);--mat-sys-surface-bright:light-dark(#fcf9f8, #393939);--mat-sys-surface-container:light-dark(#f0eded, #201f20);--mat-sys-surface-container-high:light-dark(#eae7e7, #2a2a2a);--mat-sys-surface-container-highest:light-dark(#e5e2e2, #393939);--mat-sys-surface-container-low:light-dark(#f6f3f3, #1c1b1c);--mat-sys-surface-container-lowest:light-dark(#ffffff, #0e0e0e);--mat-sys-surface-dim:light-dark(#dcd9d9, #131314);--mat-sys-surface-tint:light-dark(#595f65, #c1c7cd);--mat-sys-surface-variant:light-dark(#e1e2e6, #44474a);--mat-sys-tertiary:light-dark(#595f65, #c1c7cd);--mat-sys-tertiary-container:light-dark(#dde3e9, #41474d);--mat-sys-tertiary-fixed:light-dark(#dde3e9, #dde3e9);--mat-sys-tertiary-fixed-dim:light-dark(#c1c7cd, #c1c7cd);--mat-sys-neutral-variant20:#2d3134;--mat-sys-neutral10:#1c1b1c}html{--mat-sys-level0:0px 0px 0px 0px rgba(0, 0, 0, .2), 0px 0px 0px 0px rgba(0, 0, 0, .14), 0px 0px 0px 0px rgba(0, 0, 0, .12)}html{--mat-sys-level1:0px 2px 1px -1px rgba(0, 0, 0, .2), 0px 1px 1px 0px rgba(0, 0, 0, .14), 0px 1px 3px 0px rgba(0, 0, 0, .12)}html{--mat-sys-level2:0px 3px 3px -2px rgba(0, 0, 0, .2), 0px 3px 4px 0px rgba(0, 0, 0, .14), 0px 1px 8px 0px rgba(0, 0, 0, .12)}html{--mat-sys-level3:0px 3px 5px -1px rgba(0, 0, 0, .2), 0px 6px 10px 0px rgba(0, 0, 0, .14), 0px 1px 18px 0px rgba(0, 0, 0, .12)}html{--mat-sys-level4:0px 5px 5px -3px rgba(0, 0, 0, .2), 0px 8px 10px 1px rgba(0, 0, 0, .14), 0px 3px 14px 2px rgba(0, 0, 0, .12)}html{--mat-sys-level5:0px 7px 8px -4px rgba(0, 0, 0, .2), 0px 12px 17px 2px rgba(0, 0, 0, .14), 0px 5px 22px 4px rgba(0, 0, 0, .12)}html{--mat-sys-corner-extra-large:28px;--mat-sys-corner-extra-large-top:28px 28px 0 0;--mat-sys-corner-extra-small:4px;--mat-sys-corner-extra-small-top:4px 4px 0 0;--mat-sys-corner-full:9999px;--mat-sys-corner-large:16px;--mat-sys-corner-large-end:0 16px 16px 0;--mat-sys-corner-large-start:16px 0 0 16px;--mat-sys-corner-large-top:16px 16px 0 0;--mat-sys-corner-medium:12px;--mat-sys-corner-none:0;--mat-sys-corner-small:8px}html{--mat-sys-dragged-state-layer-opacity:.16;--mat-sys-focus-state-layer-opacity:.12;--mat-sys-hover-state-layer-opacity:.08;--mat-sys-pressed-state-layer-opacity:.12}html{font-family:Google Sans,Helvetica Neue,sans-serif!important}body{height:100vh;margin:0}:root{--mat-sys-primary:black;--mdc-checkbox-selected-icon-color:white;--mat-sys-background:#131314;--mat-tab-header-active-label-text-color:#8AB4F8;--mat-tab-header-active-hover-label-text-color:#8AB4F8;--mat-tab-header-active-focus-label-text-color:#8AB4F8;--mat-tab-header-label-text-weight:500;--mdc-text-button-label-text-color:#89b4f8}:root{--mdc-dialog-container-color:#2b2b2f}:root{--mdc-dialog-subhead-color:white}:root{--mdc-circular-progress-active-indicator-color:#a8c7fa}:root{--mdc-circular-progress-size:80}</style><link rel="stylesheet" href="./styles-4VDSPQ37.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="./styles-4VDSPQ37.css"></noscript></head>
31
31
  <body>
32
32
  <app-root></app-root>
33
- <link rel="modulepreload" href="./chunk-EQDQRRRY.js"><script src="./polyfills-FFHMD2TL.js" type="module"></script><script src="./main-RXDVX3K6.js" type="module"></script></body>
33
+ <link rel="modulepreload" href="./chunk-EQDQRRRY.js"><script src="./polyfills-B6TNHZQ6.js" type="module"></script><script src="./main-SRBSE46V.js" type="module"></script></body>
34
34
  </html>