Summary
Runner's class-level field is typed to accept node roots:
# runners.py:153
agent: Optional[BaseAgent | 'BaseNode'] = None
but the __init__ parameter was not widened to match:
# runners.py:175
agent: Optional[BaseAgent] = None,
The runtime explicitly supports a BaseNode root (e.g. a Workflow):
# runners.py:1023-1024
if isinstance(self.agent, BaseNode) and not isinstance(self.agent, BaseAgent):
...
So passing a Workflow as the root works at runtime, but type checkers (pyright) reject Runner(agent=my_workflow) against the narrower __init__ signature.
Expected
The __init__ agent parameter annotation matches the class field, e.g. Optional[BaseAgent | BaseNode].
Version
google-adk==2.3.0
Note
I only verified the __init__ agent path. There may be similar narrowing on related entry points (node=, run_live), but I have not confirmed those.
Summary
Runner's class-level field is typed to accept node roots:but the
__init__parameter was not widened to match:The runtime explicitly supports a
BaseNoderoot (e.g. aWorkflow):So passing a
Workflowas the root works at runtime, but type checkers (pyright) rejectRunner(agent=my_workflow)against the narrower__init__signature.Expected
The
__init__agentparameter annotation matches the class field, e.g.Optional[BaseAgent | BaseNode].Version
google-adk==2.3.0Note
I only verified the
__init__agentpath. There may be similar narrowing on related entry points (node=,run_live), but I have not confirmed those.