Skip to content

Commit cba77e3

Browse files
authored
Python: quiet A2AExecutor logging for unmapped content types (#7034)
* Python: quiet A2AExecutor logging for unmapped content types Tool-use responses include function_call/function_result content that the A2A executor does not surface, causing a WARNING per tool call. Log these at DEBUG and skip instead, matching the outbound content-conversion convention used across the Python chat clients. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ee74cc55-44df-4fcf-b38f-1f79f2600dfc * Address PR review: assert debug log args and drop redundant cast Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ee74cc55-44df-4fcf-b38f-1f79f2600dfc
1 parent 7ca8bb5 commit cba77e3

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

python/packages/a2a/agent_framework_a2a/_a2a_executor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,10 @@ async def handle_events(
273273
elif content.type == "uri" and content.uri:
274274
parts.append(Part(url=content.uri, media_type=content.media_type or ""))
275275
else:
276-
# Silently skip unsupported content types
277-
logger.warning("A2AExecutor does not yet support content type: %s. Omitted.", content.type)
276+
# Content that doesn't map to an A2A part (e.g. intermediate function_call /
277+
# function_result from tool use) is skipped; only final user-facing output
278+
# (text/data/uri) is surfaced.
279+
logger.debug("Skipping unsupported content type for A2A: %s", content.type)
278280

279281
if parts:
280282
if isinstance(item, AgentResponseUpdate):

python/packages/a2a/tests/test_a2a_executor.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ async def test_handle_agent_response_update_subsequent_time(
842842
assert call_kwargs["append"] is True
843843

844844
async def test_handle_unsupported_content_type(self, executor: A2AExecutor, mock_updater: MagicMock) -> None:
845-
"""Test handling messages with unsupported content types."""
845+
"""Test that unsupported content types are skipped quietly (debug, not warning)."""
846846
# Arrange
847847
message = Message(
848848
contents=[Content(type=cast(Any, "unknown"), text="Some text")], # type: ignore[arg-type]
@@ -854,7 +854,25 @@ async def test_handle_unsupported_content_type(self, executor: A2AExecutor, mock
854854
await executor.handle_events(message, mock_updater)
855855

856856
# Assert
857-
mock_logger.warning.assert_called_once()
857+
mock_logger.warning.assert_not_called()
858+
mock_logger.debug.assert_called_once_with("Skipping unsupported content type for A2A: %s", "unknown")
859+
mock_updater.update_status.assert_not_called()
860+
861+
async def test_handle_intermediate_content_type(self, executor: A2AExecutor, mock_updater: MagicMock) -> None:
862+
"""Test that intermediate tool content (e.g. function_call) is skipped quietly (debug, not warning)."""
863+
# Arrange
864+
message = Message(
865+
contents=[Content(type="function_call")],
866+
role="assistant",
867+
)
868+
869+
# Act
870+
with patch("agent_framework_a2a._a2a_executor.logger") as mock_logger:
871+
await executor.handle_events(message, mock_updater)
872+
873+
# Assert
874+
mock_logger.warning.assert_not_called()
875+
mock_logger.debug.assert_called_once_with("Skipping unsupported content type for A2A: %s", "function_call")
858876
mock_updater.update_status.assert_not_called()
859877

860878

0 commit comments

Comments
 (0)