Skip to content

[BUG]: importing LlmAgent emits BaseAgentConfig deprecation warning from ADK internals #6968

Description

@Zen-cronic

🔴 Required Information

Describe the Bug:

Importing the public LlmAgent class emits a BaseAgentConfig deprecation warning even when the application never imports or uses the deprecated YAML Agent Config feature. Test suites that treat deprecations as errors therefore fail during an ordinary ADK import.

Steps to Reproduce:

  1. Create a clean Python 3.12 environment.
  2. Install the current release.
  3. Import the supported runtime agent classes with deprecations treated as errors:
python3.12 -m venv .venv
.venv/bin/pip install 'google-adk==2.8.0'
.venv/bin/python -W error::DeprecationWarning \
  -c 'from google.adk.agents import LlmAgent, SequentialAgent'

Expected Behavior:

Importing supported programmatic runtime agent classes should not emit a warning about deprecated Agent Config APIs that the application did not use.

Observed Behavior:

The import exits 1 while ADK defines its own internal config subclass:

google/adk/agents/llm_agent.py:71
  from .llm_agent_config import LlmAgentConfig as LlmAgentConfig
google/adk/agents/llm_agent_config.py:37
  class LlmAgentConfig(BaseAgentConfig):
typing_extensions.py:3125
  warnings.warn(msg, category=category, stacklevel=stacklevel + 1)
DeprecationWarning: BaseAgentConfig is deprecated and will be removed in future versions.
Config is now loaded via reflection so the separate config class is no longer needed.

Environment Details:

  • ADK Library Version: reproduced with google-adk==2.7.1 and latest PyPI google-adk==2.8.0
  • Current main: also reproduced at 40c8333460c6337fdf05f1e33964110bd8567f5a
  • Desktop OS: Linux
  • Python Version: 3.12.12

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: N/A; the failure occurs during import before any model is configured

🟡 Optional Information

Regression:

Confirmed in 2.7.1, 2.8.0, and current unreleased main. I did not identify a released version where this import path was warning-free.

Logs:

The complete failure is the traceback above. The behavior occurs every time in a fresh interpreter.

Additional Context:

Best-supported root cause on tag v2.8.0 (76a96e6221f1e2758a1ff82fde199cd079e9c654):

  1. base_agent_config.py:36-42 decorates BaseAgentConfig with typing_extensions.deprecated.
  2. llm_agent_config.py:32-37 defines ADK's decorated LlmAgentConfig as a subclass of BaseAgentConfig.
  3. llm_agent.py:71 imports that config during an ordinary LlmAgent import.
  4. typing_extensions.deprecated warns while the deprecated base is subclassed, so the warning originates from ADK's own class declaration rather than downstream use of Agent Config.

This warning also appears in unrelated test output in #6367 and #5909, but neither artifact reports or fixes the import-time warning. The nearest sibling item is google/adk-docs#1833, which asks to document Agent Config deprecation; this issue is distinct because supported programmatic imports trigger the warning without using Agent Config.

Building Waterline surfaced this in a 54-test ADK backend suite. Waterline constructs LlmAgent and SequentialAgent programmatically and does not use YAML Agent Config.

A narrow regression test could run the import in a fresh subprocess with -W error::DeprecationWarning, so module caching cannot hide the warning. Any fix should preserve deprecation warnings for applications that actually use deprecated Agent Config APIs rather than suppressing deprecations broadly.

Minimal Reproduction Code:

from google.adk.agents import LlmAgent, SequentialAgent

Run with:

python -W error::DeprecationWarning reproduction.py

How often has this issue occurred?:

  • Always (100%)

Metadata

Metadata

Labels

request clarification[Status] The maintainer need clarification or more information from the author

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions