feat(a2a): Extend content types#1616
Draft
mkmeral wants to merge 3 commits intostrands-agents:mainfrom
Draft
Conversation
Enable Graph to accept any AgentBase implementation as a node, allowing A2AAgent and other AgentBase implementations to be used in graph workflows. Changes: - Make Agent explicitly extend AgentBase protocol - Update GraphNode.executor type to AgentBase | MultiAgentBase - Consolidate Agent handling into single AgentBase branch in _execute_node Closes strands-agents#907 (partial - enables A2AAgent in graphs)
Extend the A2A converters to handle additional content types beyond text. Input conversion (Strands → A2A): - ImageContent → FilePart with image/* MIME type - DocumentContent → FilePart with appropriate MIME type (pdf, csv, docx, etc.) - VideoContent → FilePart with video/* MIME type Output conversion (A2A → Strands): - FilePart (image/*) → ImageContent - FilePart (application/pdf, text/*, etc.) → DocumentContent - FilePart (video/*) → VideoContent Both inline bytes and URI-based references (S3 locations) are supported in both directions. MIME types are correctly mapped between Strands format literals and standard MIME type strings. Closes strands-agents#1504
Address PR review feedback: 1. URI Type Handling: The code now correctly determines the location type based on URI scheme instead of always assuming S3: - s3:// URIs → type: 's3' - http:// and https:// URIs → type: 'url' - Other schemes → type: 'uri' 2. Logging for Dropped Content: Added debug logging when content is dropped during conversion to help users diagnose issues: - Image/document/video with empty or missing source - FileParts with unsupported MIME types (e.g., audio/*) Also added new tests for URI type handling and logging behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When using A2A (Agent-to-Agent) protocol, agents frequently need to exchange rich content beyond plain text—images for vision tasks, documents for analysis, and videos for multimedia workflows. The current A2A converters only support text content, forcing developers to work around this limitation or lose content fidelity when communicating between agents.
This PR extends the A2A converters to handle image, document, and video content types, enabling seamless multimodal communication between Strands agents and any A2A-compatible agent.
Resolves: #1504
Public API Changes
No public API changes. The existing
convert_content_blocks_to_partsandconvert_response_to_agent_resultfunctions now automatically handle additional content types.The conversion is bidirectional—A2A FileParts received from remote agents are correctly converted back to Strands ImageContent, DocumentContent, or VideoContent based on MIME type.
Related Issues
#1504
Documentation PR
N/A - Internal converter changes with no user-facing API modifications.
Type of Change
New feature
Testing
How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli
hatch run prepareAdded 31 new unit tests covering:
All 136 A2A module tests pass.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.