Skip to content

fix: suppress repeated A2A experimental mode warnings#1395

Closed
fl-sean03 wants to merge 1 commit intokagent-dev:mainfrom
fl-sean03:fix/1379-suppress-a2a-experimental-warning
Closed

fix: suppress repeated A2A experimental mode warnings#1395
fl-sean03 wants to merge 1 commit intokagent-dev:mainfrom
fl-sean03:fix/1379-suppress-a2a-experimental-warning

Conversation

@fl-sean03
Copy link
Contributor

Fixes #1379

Problem

When using A2A tools, the upstream google-adk RemoteA2aAgent class is decorated with @a2a_experimental, which emits a UserWarning on every instantiation. Since kagent creates multiple RemoteA2aAgent instances (one per remote_agent), this floods logs with repeated [EXPERIMENTAL] RemoteA2aAgent: ADK Implementation for A2A support... warnings.

Fix

Add warnings.filterwarnings("once", ...) at module level in types.py to show the upstream experimental warning exactly once instead of on every RemoteA2aAgent construction. The filter matches the specific [EXPERIMENTAL]...A2A support message pattern.

This is idiomatic Python — warnings.filterwarnings("once") is the standard mechanism for deduplicating repeated warnings. The warning still appears on first occurrence so users know A2A support is experimental.

Changes

  • python/packages/kagent-adk/src/kagent/adk/types.py: Added import warnings and a filterwarnings("once") call targeting the A2A experimental warning.

Signed-off-by: Sean Florez sean@opspawn.com

Copilot AI review requested due to automatic review settings February 27, 2026 11:46
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

This PR reduces log spam when using A2A tools by ensuring the upstream google-adk experimental-mode UserWarning emitted by RemoteA2aAgent is only shown once per process.

Changes:

  • Added a module-level warnings.filterwarnings("once", ...) rule targeting the [EXPERIMENTAL] ... A2A support warning.
  • Added the warnings import required for the new filter.

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

# The warning is useful on first occurrence but floods logs when creating
# multiple remote agent instances. See: https://github.com/kagent-dev/kagent/issues/1379
warnings.filterwarnings(
"once", message=r"\[EXPERIMENTAL\].*A2A support", category=UserWarning
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

warnings.filterwarnings() prepends to the global warnings filter by default, which can override application/user warning configuration (e.g., PYTHONWARNINGS/warnings.simplefilter). Consider adding append=True so explicit user filters take precedence, and also scoping the filter with the module= regex (e.g., the google-adk remote_a2a_agent module) to avoid suppressing unrelated [EXPERIMENTAL] ... A2A support UserWarnings from other sources.

Suggested change
"once", message=r"\[EXPERIMENTAL\].*A2A support", category=UserWarning
"once",
message=r"\[EXPERIMENTAL\].*A2A support",
category=UserWarning,
module=r"^google\.adk\.agents\.remote_a2a_agent$",
append=True,

Copilot uses AI. Check for mistakes.
# The warning is useful on first occurrence but floods logs when creating
# multiple remote agent instances. See: https://github.com/kagent-dev/kagent/issues/1379
warnings.filterwarnings(
"once", message=r"\[EXPERIMENTAL\].*A2A support", category=UserWarning
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

This warnings.filterwarnings(...) call isn’t formatted consistently with the rest of the file (ruff/black style). Since CI runs ruff format --diff, please run the formatter so this block matches the repository’s formatting (likely one-line or multi-line with trailing commas).

Suggested change
"once", message=r"\[EXPERIMENTAL\].*A2A support", category=UserWarning
"once",
message=r"\[EXPERIMENTAL\].*A2A support",
category=UserWarning,

Copilot uses AI. Check for mistakes.
Add warnings.filterwarnings("once") to show the upstream google-adk
A2A experimental warning exactly once instead of on every
RemoteA2aAgent instantiation.

Fixes kagent-dev#1379

Signed-off-by: Sean Florez <sean@opspawn.com>
Signed-off-by: fl-sean03 <jmhbh@users.noreply.github.com>
@fl-sean03 fl-sean03 force-pushed the fix/1379-suppress-a2a-experimental-warning branch from 59b7f24 to a47f648 Compare February 27, 2026 12:02
@fl-sean03
Copy link
Contributor Author

Closing in favor of #1388 which was opened first. Happy to help iterate on that PR if needed.

@fl-sean03 fl-sean03 closed this Feb 28, 2026
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