Skip to content

Commit 020386a

Browse files
committed
fix(agents): restore abc.ABC base for BaseAgent and LlmAgent
BaseAgent and LlmAgent re-inherit abc.ABC. v2 GA re-rooted them on BaseNode (plain BaseModel), so static checkers no longer see an ABCMeta base and flag @abc.abstractmethod on consumer subclasses as stray, cascading into bad-return-type. Runtime is unchanged because pydantic's ModelMetaclass already extends ABCMeta; this only makes the metaclass visible to type checkers. Change-Id: I2632a180b0616a244cba97a161c1845101acd998
1 parent 81add39 commit 020386a

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/google/adk/agents/base_agent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from __future__ import annotations
1616

17+
import abc
1718
import inspect
1819
import logging
1920
from typing import Any
@@ -87,7 +88,9 @@ class BaseAgentState(BaseModel):
8788
AgentState = TypeVar('AgentState', bound=BaseAgentState)
8889

8990

90-
class BaseAgent(BaseNode):
91+
# TODO: drop the explicit abc.ABC base once BaseNode surfaces ABCMeta to
92+
# static type checkers.
93+
class BaseAgent(BaseNode, abc.ABC):
9194
"""Base class for all agents in Agent Development Kit."""
9295

9396
model_config = ConfigDict(

src/google/adk/agents/llm_agent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from __future__ import annotations
1616

17+
import abc
1718
import asyncio
1819
import importlib
1920
import inspect
@@ -192,7 +193,9 @@ async def _convert_tool_union_to_tools(
192193
return []
193194

194195

195-
class LlmAgent(BaseAgent):
196+
# TODO: drop the explicit abc.ABC base once BaseNode surfaces ABCMeta to
197+
# static type checkers.
198+
class LlmAgent(BaseAgent, abc.ABC):
196199
"""LLM-based Agent."""
197200

198201
DEFAULT_MODEL: ClassVar[str] = 'gemini-3-flash-preview'

0 commit comments

Comments
 (0)