google-adk 0.2.0__py3-none-any.whl → 0.4.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 (46) hide show
  1. google/adk/agents/base_agent.py +7 -7
  2. google/adk/agents/callback_context.py +0 -1
  3. google/adk/agents/llm_agent.py +3 -8
  4. google/adk/auth/auth_credential.py +2 -1
  5. google/adk/auth/auth_handler.py +7 -3
  6. google/adk/cli/browser/index.html +1 -1
  7. google/adk/cli/browser/{main-ZBO76GRM.js → main-HWIBUY2R.js} +69 -53
  8. google/adk/cli/cli.py +54 -47
  9. google/adk/cli/cli_deploy.py +6 -1
  10. google/adk/cli/cli_eval.py +1 -1
  11. google/adk/cli/cli_tools_click.py +78 -13
  12. google/adk/cli/fast_api.py +6 -0
  13. google/adk/evaluation/agent_evaluator.py +2 -2
  14. google/adk/evaluation/response_evaluator.py +2 -2
  15. google/adk/evaluation/trajectory_evaluator.py +4 -5
  16. google/adk/events/event_actions.py +9 -4
  17. google/adk/flows/llm_flows/agent_transfer.py +1 -1
  18. google/adk/flows/llm_flows/base_llm_flow.py +1 -1
  19. google/adk/flows/llm_flows/contents.py +10 -6
  20. google/adk/flows/llm_flows/functions.py +38 -18
  21. google/adk/flows/llm_flows/instructions.py +2 -2
  22. google/adk/models/gemini_llm_connection.py +2 -2
  23. google/adk/models/llm_response.py +10 -1
  24. google/adk/planners/built_in_planner.py +1 -0
  25. google/adk/sessions/_session_util.py +29 -0
  26. google/adk/sessions/database_session_service.py +60 -43
  27. google/adk/sessions/state.py +1 -1
  28. google/adk/sessions/vertex_ai_session_service.py +7 -5
  29. google/adk/tools/agent_tool.py +2 -3
  30. google/adk/tools/application_integration_tool/__init__.py +2 -0
  31. google/adk/tools/application_integration_tool/application_integration_toolset.py +48 -26
  32. google/adk/tools/application_integration_tool/clients/connections_client.py +26 -54
  33. google/adk/tools/application_integration_tool/integration_connector_tool.py +159 -0
  34. google/adk/tools/function_tool.py +42 -0
  35. google/adk/tools/google_api_tool/google_api_tool_set.py +12 -9
  36. google/adk/tools/load_artifacts_tool.py +1 -1
  37. google/adk/tools/openapi_tool/auth/credential_exchangers/oauth2_exchanger.py +4 -4
  38. google/adk/tools/openapi_tool/openapi_spec_parser/openapi_toolset.py +1 -1
  39. google/adk/tools/openapi_tool/openapi_spec_parser/operation_parser.py +5 -12
  40. google/adk/tools/openapi_tool/openapi_spec_parser/rest_api_tool.py +46 -8
  41. google/adk/version.py +1 -1
  42. {google_adk-0.2.0.dist-info → google_adk-0.4.0.dist-info}/METADATA +28 -9
  43. {google_adk-0.2.0.dist-info → google_adk-0.4.0.dist-info}/RECORD +46 -44
  44. {google_adk-0.2.0.dist-info → google_adk-0.4.0.dist-info}/WHEEL +0 -0
  45. {google_adk-0.2.0.dist-info → google_adk-0.4.0.dist-info}/entry_points.txt +0 -0
  46. {google_adk-0.2.0.dist-info → google_adk-0.4.0.dist-info}/licenses/LICENSE +0 -0
@@ -44,7 +44,7 @@ Args:
44
44
  callback_context: MUST be named 'callback_context' (enforced).
45
45
 
46
46
  Returns:
47
- The content to return to the user. When set, the agent run will skipped and
47
+ The content to return to the user. When set, the agent run will be skipped and
48
48
  the provided content will be returned to user.
49
49
  """
50
50
 
@@ -55,8 +55,8 @@ Args:
55
55
  callback_context: MUST be named 'callback_context' (enforced).
56
56
 
57
57
  Returns:
58
- The content to return to the user. When set, the agent run will skipped and
59
- the provided content will be appended to event history as agent response.
58
+ The content to return to the user. When set, the provided content will be
59
+ appended to event history as agent response.
60
60
  """
61
61
 
62
62
 
@@ -101,8 +101,8 @@ class BaseAgent(BaseModel):
101
101
  callback_context: MUST be named 'callback_context' (enforced).
102
102
 
103
103
  Returns:
104
- The content to return to the user. When set, the agent run will skipped and
105
- the provided content will be returned to user.
104
+ The content to return to the user. When set, the agent run will be skipped
105
+ and the provided content will be returned to user.
106
106
  """
107
107
  after_agent_callback: Optional[AfterAgentCallback] = None
108
108
  """Callback signature that is invoked after the agent run.
@@ -111,8 +111,8 @@ class BaseAgent(BaseModel):
111
111
  callback_context: MUST be named 'callback_context' (enforced).
112
112
 
113
113
  Returns:
114
- The content to return to the user. When set, the agent run will skipped and
115
- the provided content will be appended to event history as agent response.
114
+ The content to return to the user. When set, the provided content will be
115
+ appended to event history as agent response.
116
116
  """
117
117
 
118
118
  @final
@@ -23,7 +23,6 @@ from .readonly_context import ReadonlyContext
23
23
  if TYPE_CHECKING:
24
24
  from google.genai import types
25
25
 
26
- from ..events.event import Event
27
26
  from ..events.event_actions import EventActions
28
27
  from ..sessions.state import State
29
28
  from .invocation_context import InvocationContext
@@ -15,12 +15,7 @@
15
15
  from __future__ import annotations
16
16
 
17
17
  import logging
18
- from typing import Any
19
- from typing import AsyncGenerator
20
- from typing import Callable
21
- from typing import Literal
22
- from typing import Optional
23
- from typing import Union
18
+ from typing import Any, AsyncGenerator, Awaitable, Callable, Literal, Optional, Union
24
19
 
25
20
  from google.genai import types
26
21
  from pydantic import BaseModel
@@ -62,11 +57,11 @@ AfterModelCallback: TypeAlias = Callable[
62
57
  ]
63
58
  BeforeToolCallback: TypeAlias = Callable[
64
59
  [BaseTool, dict[str, Any], ToolContext],
65
- Optional[dict],
60
+ Union[Awaitable[Optional[dict]], Optional[dict]],
66
61
  ]
67
62
  AfterToolCallback: TypeAlias = Callable[
68
63
  [BaseTool, dict[str, Any], ToolContext, dict],
69
- Optional[dict],
64
+ Union[Awaitable[Optional[dict]], Optional[dict]],
70
65
  ]
71
66
 
72
67
  InstructionProvider: TypeAlias = Callable[[ReadonlyContext], str]
@@ -66,7 +66,8 @@ class OAuth2Auth(BaseModelWithConfig):
66
66
  redirect_uri: Optional[str] = None
67
67
  auth_response_uri: Optional[str] = None
68
68
  auth_code: Optional[str] = None
69
- token: Optional[Dict[str, Any]] = None
69
+ access_token: Optional[str] = None
70
+ refresh_token: Optional[str] = None
70
71
 
71
72
 
72
73
  class ServiceAccountCredential(BaseModelWithConfig):
@@ -82,7 +82,8 @@ class AuthHandler:
82
82
  or not auth_credential.oauth2
83
83
  or not auth_credential.oauth2.client_id
84
84
  or not auth_credential.oauth2.client_secret
85
- or auth_credential.oauth2.token
85
+ or auth_credential.oauth2.access_token
86
+ or auth_credential.oauth2.refresh_token
86
87
  ):
87
88
  return self.auth_config.exchanged_auth_credential
88
89
 
@@ -93,7 +94,7 @@ class AuthHandler:
93
94
  redirect_uri=auth_credential.oauth2.redirect_uri,
94
95
  state=auth_credential.oauth2.state,
95
96
  )
96
- token = client.fetch_token(
97
+ tokens = client.fetch_token(
97
98
  token_endpoint,
98
99
  authorization_response=auth_credential.oauth2.auth_response_uri,
99
100
  code=auth_credential.oauth2.auth_code,
@@ -102,7 +103,10 @@ class AuthHandler:
102
103
 
103
104
  updated_credential = AuthCredential(
104
105
  auth_type=AuthCredentialTypes.OAUTH2,
105
- oauth2=OAuth2Auth(token=dict(token)),
106
+ oauth2=OAuth2Auth(
107
+ access_token=tokens.get("access_token"),
108
+ refresh_token=tokens.get("refresh_token"),
109
+ ),
106
110
  )
107
111
  return updated_credential
108
112
 
@@ -29,5 +29,5 @@
29
29
  <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>
30
30
  <body>
31
31
  <app-root></app-root>
32
- <script src="polyfills-FFHMD2TL.js" type="module"></script><script src="main-ZBO76GRM.js" type="module"></script></body>
32
+ <script src="polyfills-FFHMD2TL.js" type="module"></script><script src="main-HWIBUY2R.js" type="module"></script></body>
33
33
  </html>