feat(transport): gRPC + REST transports for A2A multi-transport#41
feat(transport): gRPC + REST transports for A2A multi-transport#41zeroasterisk wants to merge 1 commit into
Conversation
Implements two additional A2A transports alongside the existing JSON-RPC binding, advancing ITK multi-transport interoperability (gap actioncard#4): - REST/HTTP-JSON transport (lib/a2a/transport/rest/): direct HTTP+JSON client and Plug-based server, compatible with Python/Go REST impls. Endpoints: message:send, messages (poll), agents (register/get), tasks:cancel, card. - gRPC transport (lib/a2a/grpc.ex, lib/a2a/grpc/): client + server with priv/proto/a2a.proto defining the A2A gRPC service contract. - A2A.Transport behaviour (lib/a2a/transport.ex) unifying transport selection; rest/grpc adapters under lib/a2a/transport/. - All optional deps guarded with Code.ensure_loaded?/1. Fixes a latent bug: encode_agent_card/2 requires opts[:url] via Keyword.fetch!/2, but several callers passed []; corrected to pass url: agent_card.url. Also tightened encode_agent_card/2 input spec from A2A.Agent.card() (which requires an :opts field) to A2A.AgentCard.t(), the struct actually passed by all callers (clears a dialyzer contract error). mix test: 438 tests, 0 failures. mix quality: format + credo + dialyzer all pass, 0 errors.
|
Thanks for the contribution! After reviewing this against the v1.0 tracking issue (#13) and the existing transport layer, I'd like to request changes and propose splitting this up. Scope vs #13This PR isn't part of the v1.0 roadmap tracked in #13 — that issue tracks: A2A-Version header, push notification CRUD, multi-tenant server. Multi-transport work is explicitly deferred per gRPC is currently a stubEvery gRPC client method returns # All methods should return :grpc_not_implemented for now
assert {:error, :grpc_not_implemented} = Client.send_message(client, message)
REST bypasses the existing agent contract
Other smaller issues:
The
|
|
@maxekman Thank you for the comprehensive review. Your feedback is spot-on. I agree with the proposed split approach: Split Plan:
Acknowledged Issues:
Next Steps: Current Quality Gate Status:
Will update with standalone PR for the agent card fix shortly. |
Summary
Adds two additional A2A transports alongside the existing JSON-RPC binding, advancing ITK multi-transport interoperability (gap #4).
REST / HTTP-JSON transport (
lib/a2a/transport/rest/)message:send,messages(poll),agents(register/get),tasks:cancel,card.gRPC transport (
lib/a2a/grpc.ex,lib/a2a/grpc/)priv/proto/a2a.protodefining the A2A gRPC service contract.Transport abstraction
A2A.Transportbehaviour (lib/a2a/transport.ex) unifying transport selection;rest/grpcadapters underlib/a2a/transport/.Code.ensure_loaded?/1(library stays dependency-light).Bug fixes found during finalization
encode_agent_card/2requiresopts[:url]viaKeyword.fetch!/2, but several callers passed[]→ runtimeKeyError. Corrected to passurl: agent_card.url.encode_agent_card/2input spec fromA2A.Agent.card()(requires an:optsfield) toA2A.AgentCard.t()— the struct actually passed by all callers (resolves a dialyzer contract error).Verification
mix test: 438 tests, 0 failures (stable across repeated runs)mix quality: format + credo (--strict) + dialyzer all pass, 0 errorsNotes
Opened from fork
zeroasterisk:feat/grpc-rest-transports. CI on fork PRs requires maintainer approval (action_required).