You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Type checkers reject Event convenience kwargs (route=, message=, state=, node_path=)聽#7623
Event accepts message=, state=, route= and node_path= in its
constructor, and the workflow samples use them. They are not Pydantic fields:
the mode='before' validator _accept_convenience_kwargs moves them into content, actions.state_delta, actions.route and node_info.path. Static
type checkers only see the fields, so pyright reports every such call as an
error. contributing/samples/workflows alone has 59 of them (35 message,
13 state, 11 route).
Because Event uses extra='ignore', a misspelled keyword such as Event(rout='next') is also dropped silently at runtime. A type checker is the
only tool that could catch it, but today it cannot tell the typo from the valid
keywords.
Steps to Reproduce:
Install google-adk 2.12.0 (also reproduced on main 1def14b) and pyright
1.1.407.
Save the snippet under "Minimal Reproduction Code" as typo_check.py.
Run pyright typo_check.py contributing/samples/workflows/route/agent.py.
Expected Behavior:
The four convenience kwargs type-check, and only the typo rout= is reported.
Observed Behavior:
contributing/samples/workflows/route/agent.py:28:16 - error: No parameter named "state" (reportCallIssue)
contributing/samples/workflows/route/agent.py:43:15 - error: No parameter named "route" (reportCallIssue)
contributing/samples/workflows/route/agent.py:60:7 - error: No parameter named "message" (reportCallIssue)
typo_check.py:3:7 - error: No parameter named "route" (reportCallIssue)
typo_check.py:3:21 - error: No parameter named "message" (reportCallIssue)
typo_check.py:3:35 - error: No parameter named "state" (reportCallIssue)
typo_check.py:3:51 - error: No parameter named "node_path" (reportCallIssue)
typo_check.py:4:7 - error: No parameter named "rout" (reportCallIssue)
8 errors, 0 warnings, 0 informations
mypy with the pydantic plugin accepts the convenience kwargs, but it also
accepts the typo, because Event allows extra keys.
Environment Details:
ADK Library Version (pip show google-adk): 2.12.0
Desktop OS: macOS
Python Version (python -V): 3.11.15
Model Information:
Are you using LiteLLM: N/A (no model call involved)
A fix is proposed in #7622: a TYPE_CHECKING-only __init__ that lists the
fields and the four convenience kwargs, with a unit test that keeps it in sync
with Event.model_fields.
Activity