fix(go-adk): accept standard A2A JSON-RPC method names alongside a2a-go/v2's native ones - #2496
Open
vramahandry wants to merge 1 commit into
Open
Conversation
…go/v2's native ones go/adk's A2A server serves JSON-RPC directly through a2a-go/v2's native dispatcher, which only recognizes its own bare method names (e.g. "SendMessage", "GetTask"). Every public A2A client SDK (e.g. @a2a-js/sdk, used by external A2A bridges) still sends the standard, slash-namespaced method names from the wider A2A protocol spec (e.g. "message/send", "tasks/get") — a2a-go/v2 ships a compatibility shim for exactly this (a2acompat/a2av0) but nothing in kagent wires it in, so any standards- compliant client gets a bare "-32601 method not found" against a raw go/adk agent port. The two naming conventions never collide (native names are bare identifiers; legacy names are always namespaced with a "/"), so a single peek at the request body's "method" field is enough to route correctly between a2a-go/v2's native JSON-RPC handler and the SDK's own a2av0 compatibility handler, both built from the same RequestHandler. Signed-off-by: Vivien Ramahandry <56304555+vramahandry@users.noreply.github.com>
supreme-gg-gg
left a comment
Contributor
There was a problem hiding this comment.
hi @vramahandry, it has been decided earlier that main will only support v1 A2A moving forward. Supporting dual-compatibility has been done in 0.10.x, and adding that to main will require conversion between v0 and v1 tasks and relevant migration in the database layer, which we want to avoid.
Contributor
|
For your use case, do you think you can update your client library to use v1? a2a-js v1 just released, we're using it for our UI |
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.
Summary
go/adk's A2A server serves JSON-RPC directly througha2a-go/v2's native dispatcher (a2asrv.NewJSONRPCHandler), which only recognizes its own bare method names —SendMessage,GetTask,CancelTask,SubscribeToTask, etc.Every public A2A client SDK still sends the standard, slash-namespaced method names from the wider A2A protocol spec —
message/send,message/stream,tasks/get,tasks/cancel,tasks/resubscribe,tasks/pushNotificationConfig/*,agent/getAuthenticatedExtendedCard. I confirmed this directly against the reference@a2a-js/sdk(v0.3.13) client, whose compiled transport hardcodes these exact names (node_modules/@a2a-js/sdk/dist/client/index.js).a2a-go/v2ships a compatibility shim for exactly this mismatch —a2acompat/a2av0, a complete alternate JSON-RPC handler built from the samea2asrv.RequestHandler— but nothing in kagent wires it in anywhere. The result: any standards-compliant A2A client gets a bare-32601 method not foundcalling a rawgo/adkagent port directly, even though the agent is otherwise working correctly.Discovered while validating an unrelated fix (#2475) against a real external A2A bridge: sending a message directly to the agent's port with the SDK's standard method names failed outright, while a hand-crafted request using
a2a-go/v2's native names succeeded. Confirmed this is a real, pre-existing gap onmainby diffinggo.modagainst the last release tag (v0.10.0-rc2), which still depended on the older, non-versioneda2a-gomodule (whose native dispatch already spoke the standard names) — the migration toa2a-go/v2-only dropped that compatibility with no replacement.Fixes #2497
Changes
go/adk/pkg/a2a/server/server.go: newnewCompatJSONRPCHandlerpeeks the incoming JSON-RPC request body's"method"field and routes toa2a-go/v2's native handler or the SDK's owna2acompat/a2av0handler accordingly. The two conventions never collide — native method names are bare identifiers, legacy ones are always namespaced with a/— so this single check is sufficient. Both handlers wrap the samea2asrv.RequestHandler, so behavior (including gRPC, which is untouched) stays otherwise identical.go/adk/pkg/a2a/server/server_test.go:TestJSONRPCCompatDualDispatchcovers a legacymessage/sendcall dispatching successfully, and an unrecognized legacy-shaped method still correctly reporting-32601.go/go.mod,go/go.sum:a2acompat/a2av0transitively depends on the oldera2a-gomodule (already required bya2a-go/v2's owngo.mod); added viago mod tidyafter wiring in the import.Test plan
go build ./...(bothgo/adkand the fullgo/workspace) — cleango test ./...ingo/adk— all packages pass, including the existingTestA2ARequestSizeLimit(verified the new body-peeking logic doesn't regress the size-limit error path)TestJSONRPCCompatDualDispatch— legacy method dispatches successfully; unknown legacy-shaped method still reports method-not-foundgofmt -l/go vet ./...— clean