Skip to content

Bug: thought metadata lost during A2A to GenAI part conversion #4242

@filipecaixeta

Description

@filipecaixeta

Please make sure you read the contribution guide and file the issues in the right place.
Contribution guide.

Describe the bug

The convert_a2a_part_to_genai_part function ignores metadata when converting A2A parts back to GenAI parts. This causes the thought field to be lost during A2A communication between agents, breaking remote multi-agent scenarios where reasoning/thought content needs to be preserved.

To Reproduce

from google.genai import types as genai_types
from google.adk.a2a.converters.part_converter import (
    convert_genai_part_to_a2a_part,
    convert_a2a_part_to_genai_part,
)

# Create part with thought=True
original = genai_types.Part(text="thinking...", thought=True)

# Round trip conversion
a2a_part = convert_genai_part_to_a2a_part(original)
result = convert_a2a_part_to_genai_part(a2a_part)

# Bug: thought is lost
print(f"Original thought: {original.thought}")  # True
print(f"Result thought: {result.thought}")      # None (should be True)

Steps to reproduce:

  1. Install google-adk
  2. Run the code above
  3. Observe that result.thought is None instead of True

Expected behavior

When a GenAI Part with thought=True is converted to A2A and back to GenAI, the thought field should be preserved. The round-trip should be lossless for metadata like thought.

Screenshots

N/A

Desktop (please complete the following information):

  • OS: macOS / Linux / Windows (all affected)
  • Python version: 3.11+
  • ADK version: Current main branch

Model Information:

  • Are you using LiteLLM: N/A (bug is in part conversion, not model interaction)
  • Which model is being used: N/A

Additional context

This issue affects any multi-agent A2A scenario where:

  • A sub-agent generates content with thought=True (e.g., reasoning steps)
  • The content is sent to a parent agent via A2A protocol
  • The parent agent receives the content but loses the thought marker

This makes it impossible for downstream consumers (like UIs) to distinguish thoughts from regular content.

Metadata

Metadata

Assignees

Labels

a2a[Component] This issue is related a2a support inside ADK.needs review[Status] The PR/issue is awaiting review from the maintainer

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions