Skip to content

fix: suppress repetitive A2A experimental mode warnings#1441

Open
optimus-fulcria wants to merge 3 commits intokagent-dev:mainfrom
optimus-fulcria:fix/suppress-a2a-experimental-warning
Open

fix: suppress repetitive A2A experimental mode warnings#1441
optimus-fulcria wants to merge 3 commits intokagent-dev:mainfrom
optimus-fulcria:fix/suppress-a2a-experimental-warning

Conversation

@optimus-fulcria
Copy link

Summary

  • Suppresses the repetitive [EXPERIMENTAL] RemoteA2aAgent UserWarning that floods agent logs during A2A operations
  • Adds warnings.filterwarnings() in both types.py and _agent_executor.py to filter upstream ADK experimental warnings at module import time
  • Uses a regex pattern (\[EXPERIMENTAL\].*A2A) to catch all A2A-related experimental warnings

Fixes #1379

Test plan

  • Deploy agents with A2A tools and verify logs no longer contain experimental mode warnings
  • Verify A2A functionality still works correctly (warnings are suppressed, not the functionality)

🤖 Generated with Claude Code

The upstream google-adk A2A components emit UserWarning messages about
experimental mode on every operation, flooding agent logs. This adds
warnings.filterwarnings() to suppress these known upstream warnings at
module import time.

Fixes kagent-dev#1379

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 5, 2026 15:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Suppresses repetitive upstream ADK A2A “experimental mode” warnings that spam logs during A2A operations (fixes #1379).

Changes:

  • Adds warnings.filterwarnings() in kagent.adk.types to ignore A2A-related [EXPERIMENTAL] warnings.
  • Adds the same warning filter in kagent.adk._agent_executor prior to importing upstream A2A executor components.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
python/packages/kagent-adk/src/kagent/adk/types.py Installs a module-import-time warnings filter intended to suppress ADK A2A experimental warnings.
python/packages/kagent-adk/src/kagent/adk/_agent_executor.py Installs the same warnings filter before importing upstream google.adk.a2a executor types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 12 to 14
# Suppress repetitive experimental mode warnings from upstream ADK A2A support (#1379)
warnings.filterwarnings("ignore", message=r"\[EXPERIMENTAL\].*A2A")
from google.adk.agents.remote_a2a_agent import AGENT_CARD_WELL_KNOWN_PATH, DEFAULT_TIMEOUT, RemoteA2aAgent
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warnings.filterwarnings() runs at module import time and mutates the global warnings filter for any consumer that imports kagent.adk.types (including via kagent.adk.AgentConfig). This can unexpectedly suppress warnings outside of A2A usage and makes behavior hard to opt out of. Consider scoping the filter (e.g., category=UserWarning + module= for the upstream ADK A2A modules) and/or gating it behind an explicit opt-in (env var / config) or moving it into A2A-only entrypoints instead of a widely imported types module.

Copilot uses AI. Check for mistakes.
from google.adk.agents.readonly_context import ReadonlyContext

# Suppress repetitive experimental mode warnings from upstream ADK A2A support (#1379)
warnings.filterwarnings("ignore", message=r"\[EXPERIMENTAL\].*A2A")
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using action="ignore" fully hides the upstream experimental warning. If the goal is to stop log flooding while still informing users, action="once" (or default + a de-dup strategy) would prevent repetition without completely silencing the warning.

Suggested change
warnings.filterwarnings("ignore", message=r"\[EXPERIMENTAL\].*A2A")
warnings.filterwarnings("once", message=r"\[EXPERIMENTAL\].*A2A")

Copilot uses AI. Check for mistakes.
Comment on lines +26 to +27
# Suppress repetitive experimental mode warnings from upstream ADK A2A support (#1379)
warnings.filterwarnings("ignore", message=r"\[EXPERIMENTAL\].*A2A")
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This installs the same global warnings filter as kagent.adk.types. Because warnings.filterwarnings() prepends by default, importing both modules will add duplicate entries to warnings.filters (minor overhead and harder to reason about). Consider centralizing this in a single helper that is called once, or ensure one module is the single place that configures warning suppression.

Copilot uses AI. Check for mistakes.
from google.adk.agents.readonly_context import ReadonlyContext

# Suppress repetitive experimental mode warnings from upstream ADK A2A support (#1379)
warnings.filterwarnings("ignore", message=r"\[EXPERIMENTAL\].*A2A")
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s no regression test covering this new behavior (warning suppression). Since types.py is heavily imported in tests, adding a small unit test that asserts the targeted [EXPERIMENTAL] ... A2A UserWarning is not emitted repeatedly (or that the expected filter is installed) would help prevent reintroducing log spam or accidentally over-broad suppression.

Suggested change
warnings.filterwarnings("ignore", message=r"\[EXPERIMENTAL\].*A2A")
warnings.filterwarnings(
"ignore",
message=r"\[EXPERIMENTAL\].*A2A",
category=UserWarning,
module=r"^google\.adk\.agents\.remote_a2a_agent$",
)

Copilot uses AI. Check for mistakes.
optimus-fulcria and others added 2 commits March 6, 2026 11:11
- Change filterwarnings from "ignore" to "once" so users see the
  experimental warning once per process instead of never
- Remove duplicate filter from _agent_executor.py since types.py
  (imported earlier) already installs it
- Add unit test verifying duplicate warnings are suppressed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Warning - RemoteA2aAgent experimental mode log spam

3 participants