Skip to content

[FEATURE] Public Converters for Protocol Interoperability #1578

@mkmeral

Description

@mkmeral

Problem Statement

Strands Agents has internal converters for translating between Strands types and various external protocols (A2A, OpenAI, etc.), but these are currently private implementation details. Developers building custom integrations, middleware, or extending SDK functionality need access to these conversion utilities.

Current private converters:

  • A2A: _converters.py - converts between Strands ContentBlocks/Messages and A2A Parts/Messages
  • OpenAI: Internal conversions in model providers for OpenAI-compatible formats
  • Bedrock: Internal conversions for Bedrock Converse API format

Without public converters, developers must:

  • Duplicate conversion logic in their own code
  • Reverse-engineer internal implementations
  • Risk breaking changes when internals change

Proposed Solution

Create a public strands.converters module (or per-protocol submodules) exposing well-documented conversion functions:

from strands.converters import a2a, openai

# A2A conversions
a2a_message = a2a.to_message(strands_input)
strands_result = a2a.to_agent_result(a2a_response)
a2a_parts = a2a.to_parts(content_blocks)
content_blocks = a2a.from_parts(a2a_parts)

# OpenAI conversions
openai_messages = openai.to_messages(strands_messages)
strands_messages = openai.from_messages(openai_messages)
openai_tools = openai.to_tools(tool_specs)

Scope

Protocol Direction Priority
A2A Strands ↔ A2A Messages/Parts High
OpenAI Strands ↔ OpenAI chat format High
Bedrock Strands ↔ Converse API format Medium
Anthropic Strands ↔ Anthropic API format Medium

Design Considerations

  1. Bidirectional: Support both to_* and from_* conversions where applicable
  2. Lossless where possible: Preserve metadata and content fidelity
  3. Clear error handling: Raise informative errors for unsupported content types
  4. Versioned: Consider protocol version compatibility (e.g., OpenAI API versions)

Use Case

  1. Custom A2A clients: Building A2A integrations beyond what A2AAgent provides
  2. OpenAI-compatible servers: Exposing Strands agents via OpenAI-compatible APIs
  3. Protocol bridges: Converting between different agent protocols
  4. Testing/debugging: Inspecting converted payloads during development
  5. Middleware: Building request/response interceptors that need to understand both formats

Alternatives Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-a2aA2A Relatedarea-modelRelated to models or model providersenhancementNew feature or requestpythonPull requests that update python code

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions