Skip to content

[Bug]: Response Stream Array-Wrapping Crash (Transport Layer Mismatch) #1089

Description

@xtan999

What happened?

This is continuation from #1074 as splitting into two issues are suggested by @ishymko

Copied the issue description below for context

Response Stream Array-Wrapping Crash (Transport Layer Mismatch)

By default, Google wraps streaming RPC responses (Flow<StreamResponse>) inside a JSON array [ {"task": ...} ] to frame stream chunk boundaries on the wire.

  • The Mismatch: The SDK's legacy compatibility transport (CompatRestTransport inside a2a/compat/v0_3/rest_transport.py) fails to request standard SSE transcoding from Google because it does not append the standard ?alt=sse query parameter to the stream endpoint URL. This forces Google to fall back to default plain JSON array-wrapped streams.
  • The Crash: Standard transports in a2a/client/transports/rest.py parse stream events using standard Parse (from google.protobuf.json_format):
    event: StreamResponse = Parse(sse_data, StreamResponse())
    Because standard Parse strictly expects a single JSON object {...}, the leading and trailing array brackets ([ and ]) cause json_format.Parse to crash immediately on the very first chunk:
    google.protobuf.json_format.ParseError: Failed to parse {'task': {...}} field: unhashable type: 'dict'.

Thanks for pointing this issue is not specific to v0.3 but v1 as well. Regarding the workaround mentioned in #1074 (comment) , yes it will work with the workaround but this mean all the customer/developer who integrated with Google A2A APIs will require this workaround introduces developer friction. Is there any way we could make this smoother so developer can use SDK with Google A2A API out of the box? Thanks!

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added theissue type on May 29, 2026
  2. self-assigned this
    on Jun 1, 2026
  3. added
    component: clientIssues related to transport logic and configuration for external apps connecting to A2A agents.
    on Jun 1, 2026
  4. rohityan commented on Jun 4, 2026

    @rohityan

    Hi @xtan999 , thanks for creating a separate issue for this concern. As @ishymko suggested the preferred method would be to fix it on server side. Meanwhile you could continue using the workaround as detailed in #1074 .

  5. rohityan commented on Jun 4, 2026

    @rohityan

    Hi @ishymko , PTAL.

  6. assigned and unassigned on Jun 4, 2026
  7. ishymko commented on Jun 8, 2026

    @ishymko
    Member

    Hey @xtan999, thanks for creating a separate issue!

    this mean all the customer/developer who integrated with Google A2A APIs will require this workaround introduces developer friction

    Yeah this is true, while still it doesn't feel right to me to always hardcode ?alt=sse while it's required for Google transcoding only.

    WDYT about packaging this interceptor from a workaround into an opt-in thing which can be added with 1-2 lines and documenting it? This way we will utilize existing extension points and won't "pollute" the API (as another alternative would be to add a flag for instance for RestTransport).

  8. added
    questionNeeds an answer or clarification from a maintainer.
    on Jun 10, 2026
  9. assigned and unassigned on Jun 10, 2026
  10. xtan999 commented on Jun 15, 2026

    @xtan999
    Author

    Hi @ishymko,

    Thanks for sharing the alternatives! I think any way that doesnt require user to write additional custom client code/interceptor for handling Google API would be good! Since you have more context, I will leave you to decide which option is more appropriate for the SDK.

  11. github-actions commented on Jun 29, 2026

    @github-actions
  12. assigned and unassigned on Jun 30, 2026
  13. isheng-eqi commented on Jul 7, 2026

    @isheng-eqi

    Submitted PR #1124 addressing this — adds an opt-in extra_params option to RestTransport and CompatRestTransport that threads through ClientConfig. Usage: ClientConfig(extra_params={'alt': 'sse'}). PTAL @ishymko

  14. added a commit that references this issue on Jul 25, 2026
    5471b3e
  15. added a commit that references this issue on Aug 2, 2026
    9f4f75d
  16. added a commit that references this issue on Aug 14, 2026
    b5dca6a
  17. added a commit that references this issue on Sep 16, 2026
    c00f9a4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

component: clientIssues related to transport logic and configuration for external apps connecting to A2A agents.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions