From 43270bcb6197526ba5765f83d7e4fb88f213b8d3 Mon Sep 17 00:00:00 2001 From: Google Team Member Date: Wed, 17 Dec 2025 06:48:11 -0800 Subject: [PATCH] fix: Move and enhance the deprecation warning for the plugins argument in "_validate_runner_params" to the beginning of the function Previously, the warning check occurred after "plugins" could be populated from "app.plugins". This caused the deprecation warning to trigger incorrectly even when plugins were properly provided via the app argument. Moving the check ensures it only triggers when the deprecated plugins argument is explicitly used. The change also enhanced the condition that would trigger the warning to cover the empty list case. PiperOrigin-RevId: 845746847 --- src/google/adk/runners.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/google/adk/runners.py b/src/google/adk/runners.py index 7e1a2e5d02..1773729719 100644 --- a/src/google/adk/runners.py +++ b/src/google/adk/runners.py @@ -209,6 +209,13 @@ def _validate_runner_params( Raises: ValueError: If parameters are invalid. """ + if plugins is not None: + warnings.warn( + 'The `plugins` argument is deprecated. Please use the `app` argument' + ' to provide plugins instead.', + DeprecationWarning, + ) + if app: if app_name: raise ValueError( @@ -234,12 +241,6 @@ def _validate_runner_params( context_cache_config = None resumability_config = None - if plugins: - warnings.warn( - 'The `plugins` argument is deprecated. Please use the `app` argument' - ' to provide plugins instead.', - DeprecationWarning, - ) return app_name, agent, context_cache_config, resumability_config, plugins def _infer_agent_origin(