Skip to content

[FEATURE] A2A Converter: Support additional content types beyond text #1504

@mkmeral

Description

@mkmeral

Problem Statement

The A2A converters (convert_input_to_message and convert_response_to_agent_result) currently only support TextPart content. This limits A2AAgent to text-only interactions, even though both Strands and A2A support richer content types.

When users try to send images, documents, or other content types through A2AAgent, the content is silently dropped or causes errors.

Proposed Solution

Extend the converters in src/strands/multiagent/a2a/converters.py to handle additional content types:

Input conversion (Strands → A2A)

Strands ContentBlock A2A Part Priority
text TextPart ✅ Done
image FilePart (with MIME type) High
document FilePart (with MIME type) High
video FilePart (with MIME type) Medium
toolUse / toolResult DataPart (JSON) Low

Output conversion (A2A → Strands)

A2A Part Strands ContentBlock Priority
TextPart text ✅ Done
FilePart (image/*) image High
FilePart (application/pdf, etc.) document High
FilePart (video/*) video Medium
DataPart / JsonPart Custom handling Medium

Implementation notes

  • A2A FilePart can contain either a URI or inline base64 data
  • Strands ImageContent uses source.bytes for inline data or source.url for URLs
  • MIME type mapping needed between formats

Use Case

  1. Multi-modal agents: Users want to send images to remote A2A agents for analysis (e.g., image classification, document OCR)
  2. Document processing: Send PDFs or documents to specialized A2A agents
  3. Rich responses: Receive images, charts, or generated files from A2A agents

Example:

from strands.agent import A2AAgent

agent = A2AAgent(endpoint="https://image-analyzer.example.com")

# Currently fails - image content is dropped
result = agent([
    {"role": "user", "content": [
        {"text": "What's in this image?"},
        {"image": {"source": {"bytes": image_bytes, "mediaType": "image/png"}}}
    ]}
])

Alternatives Solutions

  1. Manual conversion: Users convert content themselves before calling A2AAgent - adds friction and duplicates logic
  2. Separate methods: Add send_image(), send_document() methods - fragments the API
  3. Passthrough mode: Allow raw A2A messages - loses type safety and Strands integration

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions