Skip to content

Commit efa792e

Browse files
authored
Merge branch 'main' into feat/add-user-agent
2 parents c166bf1 + 3319787 commit efa792e

File tree

3 files changed

+54
-44
lines changed

3 files changed

+54
-44
lines changed

pyproject.toml

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,38 @@ classifiers = [ # List of https://pypi.org/classifiers/
2525
]
2626
dependencies = [
2727
# go/keep-sorted start
28-
"PyYAML>=6.0.2, <7.0.0", # For APIHubToolset.
29-
"absolufy-imports>=0.3.1, <1.0.0", # For Agent Engine deployment.
30-
"anyio>=4.9.0, <5.0.0;python_version>='3.10'", # For MCP Session Manager
31-
"authlib>=1.5.1, <2.0.0", # For RestAPI Tool
32-
"click>=8.1.8, <9.0.0", # For CLI tools
33-
"fastapi>=0.115.0, <1.0.0", # FastAPI framework
34-
"google-api-python-client>=2.157.0, <3.0.0", # Google API client discovery
35-
"google-cloud-bigtable>=2.32.0", # For Bigtable database
28+
"PyYAML>=6.0.2, <7.0.0", # For APIHubToolset.
29+
"absolufy-imports>=0.3.1, <1.0.0", # For Agent Engine deployment.
30+
"anyio>=4.9.0, <5.0.0;python_version>='3.10'", # For MCP Session Manager
31+
"authlib>=1.5.1, <2.0.0", # For RestAPI Tool
32+
"click>=8.1.8, <9.0.0", # For CLI tools
33+
"fastapi>=0.115.0, <1.0.0", # FastAPI framework
34+
"google-api-python-client>=2.157.0, <3.0.0", # Google API client discovery
35+
"google-cloud-bigtable>=2.32.0", # For Bigtable database
3636
"google-cloud-aiplatform[agent_engines]>=1.95.1, <2.0.0", # For VertexAI integrations, e.g. example store.
37-
"google-cloud-secret-manager>=2.22.0, <3.0.0", # Fetching secrets in RestAPI Tool
38-
"google-cloud-spanner>=3.56.0, <4.0.0", # For Spanner database
39-
"google-cloud-speech>=2.30.0, <3.0.0", # For Audio Transcription
40-
"google-cloud-storage>=2.18.0, <3.0.0", # For GCS Artifact service
41-
"google-genai>=1.21.1, <2.0.0", # Google GenAI SDK
42-
"graphviz>=0.20.2, <1.0.0", # Graphviz for graph rendering
43-
"mcp>=1.8.0, <2.0.0;python_version>='3.10'", # For MCP Toolset
44-
"opentelemetry-api>=1.31.0, <2.0.0", # OpenTelemetry
37+
"google-cloud-secret-manager>=2.22.0, <3.0.0", # Fetching secrets in RestAPI Tool
38+
"google-cloud-spanner>=3.56.0, <4.0.0", # For Spanner database
39+
"google-cloud-speech>=2.30.0, <3.0.0", # For Audio Transcription
40+
"google-cloud-storage>=2.18.0, <3.0.0", # For GCS Artifact service
41+
"google-genai>=1.21.1, <2.0.0", # Google GenAI SDK
42+
"graphviz>=0.20.2, <1.0.0", # Graphviz for graph rendering
43+
"mcp>=1.8.0, <2.0.0;python_version>='3.10'", # For MCP Toolset
44+
"opentelemetry-api>=1.31.0, <2.0.0", # OpenTelemetry
4545
"opentelemetry-exporter-gcp-trace>=1.9.0, <2.0.0",
4646
"opentelemetry-sdk>=1.31.0, <2.0.0",
47-
"pydantic>=2.0, <3.0.0", # For data validation/models
48-
"python-dateutil>=2.9.0.post0, <3.0.0", # For Vertext AI Session Service
49-
"python-dotenv>=1.0.0, <2.0.0", # To manage environment variables
47+
"pydantic>=2.0, <3.0.0", # For data validation/models
48+
"python-dateutil>=2.9.0.post0, <3.0.0", # For Vertext AI Session Service
49+
"python-dotenv>=1.0.0, <2.0.0", # To manage environment variables
5050
"requests>=2.32.4, <3.0.0",
51-
"sqlalchemy-spanner>=1.14.0", # Spanner database session service
52-
"sqlalchemy>=2.0, <3.0.0", # SQL database ORM
53-
"starlette>=0.46.2, <1.0.0", # For FastAPI CLI
54-
"tenacity>=8.0.0, <9.0.0", # For Retry management
51+
"sqlalchemy-spanner>=1.14.0", # Spanner database session service
52+
"sqlalchemy>=2.0, <3.0.0", # SQL database ORM
53+
"starlette>=0.46.2, <1.0.0", # For FastAPI CLI
54+
"tenacity>=8.0.0, <9.0.0", # For Retry management
5555
"typing-extensions>=4.5, <5",
56-
"tzlocal>=5.3, <6.0", # Time zone utilities
57-
"uvicorn>=0.34.0, <1.0.0", # ASGI server for FastAPI
58-
"watchdog>=6.0.0, <7.0.0", # For file change detection and hot reload
59-
"websockets>=15.0.1, <16.0.0", # For BaseLlmFlow
56+
"tzlocal>=5.3, <6.0", # Time zone utilities
57+
"uvicorn>=0.34.0, <1.0.0", # ASGI server for FastAPI
58+
"watchdog>=6.0.0, <7.0.0", # For file change detection and hot reload
59+
"websockets>=15.0.1, <16.0.0", # For BaseLlmFlow
6060
# go/keep-sorted end
6161
]
6262
dynamic = ["version"]
@@ -99,18 +99,20 @@ eval = [
9999

100100
test = [
101101
# go/keep-sorted start
102-
"anthropic>=0.43.0", # For anthropic model tests
102+
"a2a-sdk>=0.3.0,<0.4.0;python_version>='3.10'",
103+
"anthropic>=0.43.0", # For anthropic model tests
103104
"langchain-community>=0.3.17",
104-
# langgraph 0.5 removed langgraph.graph.graph which we depend on
105-
"langgraph>=0.2.60, <= 0.4.10", # For LangGraphAgent
106-
"litellm>=1.75.5, <2.0.0", # For LiteLLM tests
107-
"llama-index-readers-file>=0.4.0", # For retrieval tests
108-
"openai>=1.100.2", # For LiteLLM
105+
"langgraph>=0.2.60, <= 0.4.10", # For LangGraphAgent
106+
"litellm>=1.75.5, <2.0.0", # For LiteLLM tests
107+
"llama-index-readers-file>=0.4.0", # For retrieval tests
108+
"openai>=1.100.2", # For LiteLLM
109109
"pytest-asyncio>=0.25.0",
110110
"pytest-mock>=3.14.0",
111111
"pytest-xdist>=3.6.1",
112112
"pytest>=8.3.4",
113113
"python-multipart>=0.0.9",
114+
"rouge-score>=0.1.2",
115+
"tabulate>=0.9.0",
114116
# go/keep-sorted end
115117
]
116118

src/google/adk/agents/base_agent_config.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,3 @@ class BaseAgentConfig(BaseModel):
7979
default=None,
8080
description='Optional. The after_agent_callbacks of the agent.',
8181
)
82-
83-
def to_agent_config(
84-
self, custom_agent_config_cls: Type[TBaseAgentConfig]
85-
) -> TBaseAgentConfig:
86-
"""Converts this config to the concrete agent config type.
87-
88-
NOTE: this is for ADK framework use only.
89-
"""
90-
return custom_agent_config_cls.model_validate(self.model_dump())

tests/unittests/agents/test_agent_config.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
from typing import Literal
216

317
from google.adk.agents.agent_config import AgentConfig
@@ -115,9 +129,12 @@ class MyCustomAgentConfig(BaseAgentConfig):
115129

116130
config = AgentConfig.model_validate(config_data)
117131

118-
assert isinstance(config.root, BaseAgentConfig)
132+
# pylint: disable=unidiomatic-typecheck Needs exact class matching.
133+
assert type(config.root) is BaseAgentConfig
119134
assert config.root.agent_class == "mylib.agents.MyCustomAgent"
120135
assert config.root.model_extra == {"other_field": "other value"}
121136

122-
my_custom_config = config.root.to_agent_config(MyCustomAgentConfig)
137+
my_custom_config = MyCustomAgentConfig.model_validate(
138+
config.root.model_dump()
139+
)
123140
assert my_custom_config.other_field == "other value"

0 commit comments

Comments
 (0)