Skip to content

HTTP+JSON payload shape mismatches proto‑JSON (ADK/Agent Engine 400s) #291

@adamfweidman

Description

@adamfweidman

What happened?

Bug Report / Feature Request: HTTP+JSON Payload Shape

Reference PR in gemini-cli: google-gemini/gemini-cli#16013

Summary

HTTP+JSON requests from @a2a-js/[email protected] are rejected by ADK/Agent Engine
unless the client rewrites request/response payloads. The SDK emits a legacy
JSON shape that does not match the spec’s proto-JSON binding.

Environment

  • @a2a-js/[email protected]
  • Node 18+
  • ClientFactory + HTTP+JSON transport
  • Server: ADK/Agent Engine (A2A REST adapter)

Repro (API call that rejects)

The SDK sends a POST to /v1/message:send with this shape:

{
  "message": {
    "kind": "message",
    "role": "user",
    "messageId": "msg-1",
    "parts": [{ "kind": "text", "text": "hello" }]
  },
  "configuration": { "blocking": true }
}

Response from ADK/Agent Engine: HTTP 400 (request rejected).

Spec vs SDK Mismatch (Summary)

Spec (proto-JSON): ROLE_* enums, parts oneof (no kind), TASK_STATE_*,
wrapper responses { task|message: ... }.
SDK 0.3.7: role: "user", parts with kind, lower-case task states, expects
bare Task/Message.

Impact

When talking to ADK/Agent Engine (which parses proto-JSON), requests are
rejected (invalid enum values / unknown fields), or responses cannot be
parsed because they are wrapped.

This forces client applications to implement a shim that:

  • maps user -> ROLE_USER
  • converts parts to proto-JSON oneof form (no kind)
  • unwraps { task: ... } / { message: ... }
  • maps TASK_STATE_* to lower-case states

Request

Add a proto-JSON mode (or dedicated transport) for HTTP+JSON that:

  • emits ROLE_* enums
  • encodes parts oneof without kind
  • unwraps { task|message: ... }
  • maps TASK_STATE_* for SDK consumers

Relevant log output

Code of Conduct

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions