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
This commit is contained in:
Google Team Member
2025-12-17 06:48:44 -08:00
committed by Copybara-Service
parent 322dd1827a
commit 43270bcb61
+7 -6
View File
@@ -209,6 +209,13 @@ class Runner:
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 @@ class Runner:
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(