@@ -32,29 +32,29 @@ class FakeEvaluator:
3232
3333 def __init__ (self , block_on : str | None = None ) -> None :
3434 self .block_on = block_on
35- self .calls : List [tuple [str , dict ]] = []
35+ self .calls : List [tuple [str , dict [ str , Any ] ]] = []
3636
3737 def _record (self , hook : str , ** kwargs : Any ) -> None :
3838 self .calls .append ((hook , kwargs ))
3939 if self .block_on == hook :
4040 raise GovernanceBlockException ("blocked" ) # type: ignore[call-arg]
4141
42- def evaluate_before_agent (self , ** kwargs : Any ) -> None :
42+ def evaluate_before_agent (self , * args : Any , ** kwargs : Any ) -> Any :
4343 self ._record ("before_agent" , ** kwargs )
4444
45- def evaluate_after_agent (self , ** kwargs : Any ) -> None :
45+ def evaluate_after_agent (self , * args : Any , ** kwargs : Any ) -> Any :
4646 self ._record ("after_agent" , ** kwargs )
4747
48- def evaluate_before_model (self , ** kwargs : Any ) -> None :
48+ def evaluate_before_model (self , * args : Any , ** kwargs : Any ) -> Any :
4949 self ._record ("before_model" , ** kwargs )
5050
51- def evaluate_after_model (self , ** kwargs : Any ) -> None :
51+ def evaluate_after_model (self , * args : Any , ** kwargs : Any ) -> Any :
5252 self ._record ("after_model" , ** kwargs )
5353
54- def evaluate_tool_call (self , ** kwargs : Any ) -> None :
54+ def evaluate_tool_call (self , * args : Any , ** kwargs : Any ) -> Any :
5555 self ._record ("tool_call" , ** kwargs )
5656
57- def evaluate_after_tool (self , ** kwargs : Any ) -> None :
57+ def evaluate_after_tool (self , * args : Any , ** kwargs : Any ) -> Any :
5858 self ._record ("after_tool" , ** kwargs )
5959
6060
@@ -429,9 +429,9 @@ def evaluate_before_model(self, **_):
429429 raise RuntimeError ("evaluator bug" )
430430
431431 cb = GovernanceCallbacks (
432- evaluator = Boom (),
432+ evaluator = Boom (), # type: ignore[arg-type] # minimal test double
433433 agent_name = "a" ,
434- session_id = "s" , # type: ignore[arg-type]
434+ session_id = "s" ,
435435 )
436436 with caplog .at_level (logging .WARNING ):
437437 # must NOT raise — a governance bug can't break the agent run
@@ -440,8 +440,11 @@ def evaluate_before_model(self, **_):
440440
441441
442442def test_callbacks_return_none ():
443+ # callbacks return None (ADK: a None return means "don't override the
444+ # model/tool"); the type: ignores silence mypy's func-returns-value on the
445+ # None-returning callbacks while the asserts document that contract.
443446 cb = _make_callbacks (FakeEvaluator ())
444- assert cb .before_model (None , SimpleNamespace (contents = [])) is None
445- assert cb .after_model (None , SimpleNamespace (partial = False , content = None )) is None
446- assert cb .before_tool (FakeTool ("t" ), {}, None ) is None
447- assert cb .after_tool (FakeTool ("t" ), {}, None , {}) is None
447+ assert cb .before_model (None , SimpleNamespace (contents = [])) is None # type: ignore[func-returns-value]
448+ assert cb .after_model (None , SimpleNamespace (partial = False , content = None )) is None # type: ignore[func-returns-value]
449+ assert cb .before_tool (FakeTool ("t" ), {}, None ) is None # type: ignore[func-returns-value]
450+ assert cb .after_tool (FakeTool ("t" ), {}, None , {}) is None # type: ignore[func-returns-value]
0 commit comments