fix: suppress repetitive A2A experimental mode warnings#1441
fix: suppress repetitive A2A experimental mode warnings#1441optimus-fulcria wants to merge 3 commits intokagent-dev:mainfrom
Conversation
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>
There was a problem hiding this comment.
Pull request overview
Suppresses repetitive upstream ADK A2A “experimental mode” warnings that spam logs during A2A operations (fixes #1379).
Changes:
- Adds
warnings.filterwarnings()inkagent.adk.typesto ignore A2A-related[EXPERIMENTAL]warnings. - Adds the same warning filter in
kagent.adk._agent_executorprior 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.
| # 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 |
There was a problem hiding this comment.
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.
| 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") |
There was a problem hiding this comment.
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.
| warnings.filterwarnings("ignore", message=r"\[EXPERIMENTAL\].*A2A") | |
| warnings.filterwarnings("once", message=r"\[EXPERIMENTAL\].*A2A") |
| # Suppress repetitive experimental mode warnings from upstream ADK A2A support (#1379) | ||
| warnings.filterwarnings("ignore", message=r"\[EXPERIMENTAL\].*A2A") |
There was a problem hiding this comment.
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.
| 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") |
There was a problem hiding this comment.
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.
| warnings.filterwarnings("ignore", message=r"\[EXPERIMENTAL\].*A2A") | |
| warnings.filterwarnings( | |
| "ignore", | |
| message=r"\[EXPERIMENTAL\].*A2A", | |
| category=UserWarning, | |
| module=r"^google\.adk\.agents\.remote_a2a_agent$", | |
| ) |
- 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>
Summary
[EXPERIMENTAL] RemoteA2aAgentUserWarning that floods agent logs during A2A operationswarnings.filterwarnings()in bothtypes.pyand_agent_executor.pyto filter upstream ADK experimental warnings at module import time\[EXPERIMENTAL\].*A2A) to catch all A2A-related experimental warningsFixes #1379
Test plan
🤖 Generated with Claude Code