Skip to content

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

Closed

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.

Activity

  1. added
    a2a
    on Jan 22, 2026
  2. added theissue type on Jan 22, 2026
  3. surajksharma07 commented on Jan 30, 2026

    @surajksharma07
    Collaborator

    @filipecaixeta the bug is in part_converter.py:63-64 where convert_a2a_part_to_genai_part returns genai_types.Part(text=part.text) without reading back the thought metadata that was stored during the forward conversion at line 163.

    Your PR #4241 looks like the right fix.

    As a workaround until it's merged, you can monkey-patch convert_a2a_part_to_genai_part to read part.metadata.get(_get_adk_metadata_key('thought')) and pass it to the Part constructor.

    Team is looking more into it.

  4. filipecaixeta commented on Feb 24, 2026

    @filipecaixeta
    ContributorAuthor

    @surajksharma07 I've been waiting for over a month for this.

  5. added
    needs review
    on Feb 25, 2026
  6. surajksharma07 commented on Feb 25, 2026

    @surajksharma07
    Collaborator

    @seanzhou1023 Please have a look into it.

  7. surajksharma07 commented on Feb 25, 2026

    @surajksharma07
    Collaborator

    @filipecaixeta Apologies for the delay — your PR #4241 has been escalated for review and assigned to a team member.

  8. removed their assignment
    on Feb 26, 2026
  9. sasha-gitg commented on Mar 2, 2026

    @sasha-gitg
    Collaborator

    This seems to be resolved: e59929e1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

a2aneeds review

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions