@@ -308,7 +308,7 @@ def _initialize_from_snapshot( # type: ignore[override]
308308 tool_execution_decisions = snapshot .tool_execution_decisions ,
309309 )
310310
311- def run ( # type: ignore[override] # noqa: PLR0915 PLR0912
311+ def run ( # type: ignore[override] # noqa: PLR0915 PLR0912 C901
312312 self ,
313313 messages : list [ChatMessage ],
314314 streaming_callback : StreamingCallbackT | None = None ,
@@ -381,7 +381,11 @@ def run( # type: ignore[override] # noqa: PLR0915 PLR0912
381381 }
382382 # TODO Probably good to add a warning in runtime checks that BreakpointConfirmationStrategy will take
383383 # precedence over passing a ToolBreakpoint
384- self ._runtime_checks (break_point )
384+ # Support both old signature (break_point) and new signature (break_point, tools)
385+ _runtime_checks_kwargs : dict [str , Any ] = {"break_point" : break_point }
386+ if "tools" in inspect .signature (HaystackAgent ._runtime_checks ).parameters :
387+ _runtime_checks_kwargs ["tools" ] = tools
388+ self ._runtime_checks (** _runtime_checks_kwargs )
385389
386390 if snapshot :
387391 exe_context = self ._initialize_from_snapshot (
@@ -573,7 +577,7 @@ def run( # type: ignore[override] # noqa: PLR0915 PLR0912
573577
574578 return result
575579
576- async def run_async ( # type: ignore[override] # noqa: PLR0915
580+ async def run_async ( # type: ignore[override] # noqa: PLR0915 PLR0912
577581 self ,
578582 messages : list [ChatMessage ],
579583 streaming_callback : StreamingCallbackT | None = None ,
@@ -647,7 +651,10 @@ async def run_async( # type: ignore[override] # noqa: PLR0915
647651 "snapshot" : snapshot ,
648652 ** kwargs ,
649653 }
650- self ._runtime_checks (break_point )
654+ _runtime_checks_kwargs : dict [str , Any ] = {"break_point" : break_point }
655+ if "tools" in inspect .signature (HaystackAgent ._runtime_checks ).parameters :
656+ _runtime_checks_kwargs ["tools" ] = tools
657+ self ._runtime_checks (** _runtime_checks_kwargs )
651658
652659 if snapshot :
653660 exe_context = self ._initialize_from_snapshot (
0 commit comments