Skip to content

Commit 4531162

Browse files
authored
Merge branch 'main' into feat/gcs-file-data-support
2 parents 76aff31 + 8846be5 commit 4531162

File tree

27 files changed

+603
-207
lines changed

27 files changed

+603
-207
lines changed

contributing/samples/local_environment_skill/agent.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,38 +15,7 @@
1515

1616
from google.adk import Agent
1717
from google.adk.environment import LocalEnvironment
18-
from google.adk.tools.base_tool import BaseTool
1918
from google.adk.tools.environment import EnvironmentToolset
20-
from google.genai import types
21-
22-
23-
class GetTimezoneTool(BaseTool):
24-
"""A tool to get the timezone for a given location."""
25-
26-
def __init__(self):
27-
super().__init__(
28-
name="get_timezone",
29-
description="Returns the timezone for a given location.",
30-
)
31-
32-
def _get_declaration(self) -> types.FunctionDeclaration | None:
33-
return types.FunctionDeclaration(
34-
name=self.name,
35-
description=self.description,
36-
parameters_json_schema={
37-
"type": "object",
38-
"properties": {
39-
"location": {
40-
"type": "string",
41-
"description": "The location to get the timezone for.",
42-
},
43-
},
44-
"required": ["location"],
45-
},
46-
)
47-
48-
async def run_async(self, *, args: dict, tool_context) -> str:
49-
return f"The timezone for {args['location']} is UTC+00:00."
5019

5120

5221
def get_wind_speed(location: str) -> str:
@@ -89,7 +58,6 @@ def get_wind_speed(location: str) -> str:
8958
working_dir=pathlib.Path(__file__).parent
9059
),
9160
),
92-
GetTimezoneTool(),
9361
get_wind_speed,
9462
],
9563
)

contributing/samples/local_environment_skill/skills/weather-skill/SKILL.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
---
22
name: weather-skill
33
description: A skill that provides weather information based on reference data.
4-
metadata:
5-
adk_additional_tools:
6-
- get_wind_speed
74
---
85

96
Step 1: Check 'references/weather_info.md' for the current weather.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies = [
3333
"fastapi>=0.124.1, <1.0.0", # FastAPI framework
3434
"google-api-python-client>=2.157.0, <3.0.0", # Google API client discovery
3535
"google-auth[pyopenssl]>=2.47.0", # Google Auth library
36-
"google-cloud-aiplatform[agent_engines]>=1.132.0, <2.0.0", # For VertexAI integrations, e.g. example store.
36+
"google-cloud-aiplatform[agent_engines]>=1.148.0, <2.0.0", # For VertexAI integrations, e.g. example store.
3737
"google-cloud-bigquery-storage>=2.0.0",
3838
"google-cloud-bigquery>=2.2.0",
3939
"google-cloud-bigtable>=2.32.0", # For Bigtable database
@@ -111,7 +111,7 @@ eval = [
111111
# go/keep-sorted start
112112
"Jinja2>=3.1.4,<4.0.0", # For eval template rendering
113113
"gepa>=0.1.0",
114-
"google-cloud-aiplatform[evaluation]>=1.143.0",
114+
"google-cloud-aiplatform[evaluation]>=1.148.0",
115115
"pandas>=2.2.3",
116116
"rouge-score>=0.1.2",
117117
"tabulate>=0.9.0",

src/google/adk/agents/common_configs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class AgentRefConfig(BaseModel):
118118
my_custom_agent = LlmAgent(
119119
name="my_custom_agent",
120120
instruction="You are a helpful custom agent.",
121-
model="gemini-2.0-flash",
121+
model="gemini-2.5-flash",
122122
)
123123
```
124124

src/google/adk/agents/config_schemas/AgentConfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2461,7 +2461,7 @@
24612461
}
24622462
],
24632463
"default": null,
2464-
"description": "Optional. LlmAgent.model. Provide a model name string (e.g. \"gemini-2.0-flash\"). If not set, the model will be inherited from the ancestor or fall back to the system default (gemini-2.5-flash unless overridden via LlmAgent.set_default_model). To construct a model instance from code, use model_code.",
2464+
"description": "Optional. LlmAgent.model. Provide a model name string (e.g. \"gemini-2.5-flash\"). If not set, the model will be inherited from the ancestor or fall back to the system default (gemini-2.5-flash unless overridden via LlmAgent.set_default_model). To construct a model instance from code, use model_code.",
24652465
"title": "Model"
24662466
},
24672467
"instruction": {

src/google/adk/agents/llm_agent_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class LlmAgentConfig(BaseAgentConfig):
5555
default=None,
5656
description=(
5757
'Optional. LlmAgent.model. Provide a model name string (e.g.'
58-
' "gemini-2.0-flash"). If not set, the model will be inherited from'
58+
' "gemini-2.5-flash"). If not set, the model will be inherited from'
5959
' the ancestor or fall back to the system default (gemini-2.5-flash'
6060
' unless overridden via LlmAgent.set_default_model). To construct a'
6161
' model instance from code, use model_code.'

src/google/adk/agents/loop_agent.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@ async def _run_async_impl(
108108
if should_exit or pause_invocation:
109109
break # break inner for loop
110110

111-
# Restart from the beginning of the loop.
112-
start_index = 0
113-
times_looped += 1
114-
# Reset the state of all sub-agents in the loop.
115-
ctx.reset_sub_agent_states(self.name)
111+
if not pause_invocation:
112+
# Restart from the beginning of the loop.
113+
start_index = 0
114+
times_looped += 1
115+
# Reset the state of all sub-agents in the loop.
116+
ctx.reset_sub_agent_states(self.name)
116117

117118
# If the invocation is paused, we should not yield the end of agent event.
118119
if pause_invocation:

src/google/adk/cli/browser/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@
3030
<style>html{--mat-sys-background:#151316;--mat-sys-error:#ffb4ab;--mat-sys-error-container:#93000a;--mat-sys-inverse-on-surface:#323033;--mat-sys-inverse-primary:#7d00fa;--mat-sys-inverse-surface:#e6e1e6;--mat-sys-on-background:#e6e1e6;--mat-sys-on-error:#690005;--mat-sys-on-error-container:#ffdad6;--mat-sys-on-primary:#42008a;--mat-sys-on-primary-container:#ecdcff;--mat-sys-on-primary-fixed:#270057;--mat-sys-on-primary-fixed-variant:#5f00c0;--mat-sys-on-secondary:#352d40;--mat-sys-on-secondary-container:#eadef7;--mat-sys-on-secondary-fixed:#1f182a;--mat-sys-on-secondary-fixed-variant:#4b4357;--mat-sys-on-surface:#e6e1e6;--mat-sys-on-surface-variant:#e8e0eb;--mat-sys-on-tertiary:#42008a;--mat-sys-on-tertiary-container:#ecdcff;--mat-sys-on-tertiary-fixed:#270057;--mat-sys-on-tertiary-fixed-variant:#5f00c0;--mat-sys-outline:#958e99;--mat-sys-outline-variant:#49454e;--mat-sys-primary:#d5baff;--mat-sys-primary-container:#5f00c0;--mat-sys-primary-fixed:#ecdcff;--mat-sys-primary-fixed-dim:#d5baff;--mat-sys-scrim:#000000;--mat-sys-secondary:#cec2db;--mat-sys-secondary-container:#4b4357;--mat-sys-secondary-fixed:#eadef7;--mat-sys-secondary-fixed-dim:#cec2db;--mat-sys-shadow:#000000;--mat-sys-surface:#151316;--mat-sys-surface-bright:#3b383c;--mat-sys-surface-container:#211f22;--mat-sys-surface-container-high:#2b292d;--mat-sys-surface-container-highest:#363437;--mat-sys-surface-container-low:#1d1b1e;--mat-sys-surface-container-lowest:#0f0d11;--mat-sys-surface-dim:#151316;--mat-sys-surface-tint:#d5baff;--mat-sys-surface-variant:#49454e;--mat-sys-tertiary:#d5baff;--mat-sys-tertiary-container:#5f00c0;--mat-sys-tertiary-fixed:#ecdcff;--mat-sys-tertiary-fixed-dim:#d5baff;--mat-sys-neutral-variant20:#332f37;--mat-sys-neutral10:#1d1b1e;--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);--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);--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);--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);--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);--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);--mat-sys-body-large:400 1rem / 1.5rem Google Sans;--mat-sys-body-large-font:Google Sans;--mat-sys-body-large-line-height:1.5rem;--mat-sys-body-large-size:1rem;--mat-sys-body-large-tracking:.031rem;--mat-sys-body-large-weight:400;--mat-sys-body-medium:400 .875rem / 1.25rem Google Sans;--mat-sys-body-medium-font:Google Sans;--mat-sys-body-medium-line-height:1.25rem;--mat-sys-body-medium-size:.875rem;--mat-sys-body-medium-tracking:.016rem;--mat-sys-body-medium-weight:400;--mat-sys-body-small:400 .75rem / 1rem Google Sans;--mat-sys-body-small-font:Google Sans;--mat-sys-body-small-line-height:1rem;--mat-sys-body-small-size:.75rem;--mat-sys-body-small-tracking:.025rem;--mat-sys-body-small-weight:400;--mat-sys-display-large:400 3.562rem / 4rem Google Sans;--mat-sys-display-large-font:Google Sans;--mat-sys-display-large-line-height:4rem;--mat-sys-display-large-size:3.562rem;--mat-sys-display-large-tracking:-.016rem;--mat-sys-display-large-weight:400;--mat-sys-display-medium:400 2.812rem / 3.25rem Google Sans;--mat-sys-display-medium-font:Google Sans;--mat-sys-display-medium-line-height:3.25rem;--mat-sys-display-medium-size:2.812rem;--mat-sys-display-medium-tracking:0;--mat-sys-display-medium-weight:400;--mat-sys-display-small:400 2.25rem / 2.75rem Google Sans;--mat-sys-display-small-font:Google Sans;--mat-sys-display-small-line-height:2.75rem;--mat-sys-display-small-size:2.25rem;--mat-sys-display-small-tracking:0;--mat-sys-display-small-weight:400;--mat-sys-headline-large:400 2rem / 2.5rem Google Sans;--mat-sys-headline-large-font:Google Sans;--mat-sys-headline-large-line-height:2.5rem;--mat-sys-headline-large-size:2rem;--mat-sys-headline-large-tracking:0;--mat-sys-headline-large-weight:400;--mat-sys-headline-medium:400 1.75rem / 2.25rem Google Sans;--mat-sys-headline-medium-font:Google Sans;--mat-sys-headline-medium-line-height:2.25rem;--mat-sys-headline-medium-size:1.75rem;--mat-sys-headline-medium-tracking:0;--mat-sys-headline-medium-weight:400;--mat-sys-headline-small:400 1.5rem / 2rem Google Sans;--mat-sys-headline-small-font:Google Sans;--mat-sys-headline-small-line-height:2rem;--mat-sys-headline-small-size:1.5rem;--mat-sys-headline-small-tracking:0;--mat-sys-headline-small-weight:400;--mat-sys-label-large:500 .875rem / 1.25rem Google Sans;--mat-sys-label-large-font:Google Sans;--mat-sys-label-large-line-height:1.25rem;--mat-sys-label-large-size:.875rem;--mat-sys-label-large-tracking:.006rem;--mat-sys-label-large-weight:500;--mat-sys-label-large-weight-prominent:700;--mat-sys-label-medium:500 .75rem / 1rem Google Sans;--mat-sys-label-medium-font:Google Sans;--mat-sys-label-medium-line-height:1rem;--mat-sys-label-medium-size:.75rem;--mat-sys-label-medium-tracking:.031rem;--mat-sys-label-medium-weight:500;--mat-sys-label-medium-weight-prominent:700;--mat-sys-label-small:500 .688rem / 1rem Google Sans;--mat-sys-label-small-font:Google Sans;--mat-sys-label-small-line-height:1rem;--mat-sys-label-small-size:.688rem;--mat-sys-label-small-tracking:.031rem;--mat-sys-label-small-weight:500;--mat-sys-title-large:400 1.375rem / 1.75rem Google Sans;--mat-sys-title-large-font:Google Sans;--mat-sys-title-large-line-height:1.75rem;--mat-sys-title-large-size:1.375rem;--mat-sys-title-large-tracking:0;--mat-sys-title-large-weight:400;--mat-sys-title-medium:500 1rem / 1.5rem Google Sans;--mat-sys-title-medium-font:Google Sans;--mat-sys-title-medium-line-height:1.5rem;--mat-sys-title-medium-size:1rem;--mat-sys-title-medium-tracking:.009rem;--mat-sys-title-medium-weight:500;--mat-sys-title-small:500 .875rem / 1.25rem Google Sans;--mat-sys-title-small-font:Google Sans;--mat-sys-title-small-line-height:1.25rem;--mat-sys-title-small-size:.875rem;--mat-sys-title-small-tracking:.006rem;--mat-sys-title-small-weight:500;--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;--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;color-scheme:dark;--mat-sys-primary:#7cc4ff;--mat-sys-on-primary:#003366;--mat-sys-primary-container:#004b8d;--mat-sys-on-primary-container:#d1e4ff;--mat-sys-secondary:#b5c9e2;--mat-sys-on-secondary:#203246;--mat-sys-secondary-container:#3a485a;--mat-sys-on-secondary-container:#d7e3f7}body{height:100vh;margin:0;font-family:Roboto,Helvetica Neue,sans-serif}</style><link rel="stylesheet" href="./styles-2ORK6PRA.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="./styles-2ORK6PRA.css"></noscript></head>
3131
<body>
3232
<app-root></app-root>
33-
<link rel="modulepreload" href="./chunk-EN473UE3.js"><link rel="modulepreload" href="./chunk-W7GRJBO5.js"><script src="./polyfills-5CFQRCPP.js" type="module"></script><script src="./main-IY3KRCSN.js" type="module"></script></body>
33+
<link rel="modulepreload" href="./chunk-EN473UE3.js"><link rel="modulepreload" href="./chunk-W7GRJBO5.js"><script src="./polyfills-5CFQRCPP.js" type="module"></script><script src="./main-3OBAHHYV.js" type="module"></script></body>
3434
</html>

src/google/adk/cli/browser/main-IY3KRCSN.js renamed to src/google/adk/cli/browser/main-3OBAHHYV.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/google/adk/flows/llm_flows/base_llm_flow.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -720,19 +720,21 @@ async def _receive_from_model(
720720
) -> AsyncGenerator[Event, None]:
721721
"""Receive data from model and process events using BaseLlmConnection."""
722722

723-
def get_author_for_event(llm_response):
723+
def get_author_for_event(llm_response: LlmResponse) -> str:
724724
"""Get the author of the event.
725725
726-
When the model returns transcription, the author is "user". Otherwise, the
727-
author is the agent name(not 'model').
726+
When the model returns input transcription, the author is set to "user".
727+
Otherwise, the author is the agent name (not 'model').
728728
729729
Args:
730730
llm_response: The LLM response from the LLM call.
731+
732+
Returns:
733+
The author of the event as a string, either "user" or the agent's name.
731734
"""
732-
if (
733-
llm_response
734-
and llm_response.content
735-
and llm_response.content.role == 'user'
735+
if llm_response and (
736+
llm_response.input_transcription
737+
or (llm_response.content and llm_response.content.role == 'user')
736738
):
737739
return 'user'
738740
else:

0 commit comments

Comments
 (0)