-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feature: Golang sample implementation #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
Signed-off-by: Alex Jones <[email protected]>
bwplotka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Looks clean and solid to me!
Would be nice to have a Go example for A2A protocol 💪🏽
I don't maintain this repo, but I will do a friendly ping internally for feedback 🤗
tucnak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good by eye, but not good enough
- Renamed handleRequest to ServeHTTP to implement http.Handler interface - Updated server tests to use ServeHTTP method - Added warning in README about sample code not for production use - Improved server design to be more idiomatic Go code - Fixed module path and import references Signed-off-by: Alex Jones <[email protected]>
|
@whitlockjc would you be so kind as to push this one through. I would like to land this go example. |
|
Just holla if I need to change anything |
|
I'm on it...started a few times but deadlines have distracted me. 😆 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution! The major concern right now is that streaming support seems to be missing, and while I think we could handle this in a follow-up, I think there is enough interest in this to ensure it's as complete as possible off the rip. Thoughts?
I had thought about breaking it up, but I'll see what I can get done tonight/tomorrow and update the PR |
Signed-off-by: Alex Jones <[email protected]>
Enhance the handleStreamingTask function with better error handling and resource management.
|
Okay, added streaming, had a bit of a refactor to avoid a double closure issue. |
Signed-off-by: Alex Jones <[email protected]>
|
I'm on it. |
|
What do you think @whitlockjc ? I have some time if changes are needed mid week! |
|
Have you checked this implementation from @trpc-group? It can be helpful (or a distraction right now). |
whitlockjc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
LGTM. Can we either cleanup to pass the (new) spelling and linting CI/CD checks or recommend changes to the checks? |
|
Hi, anything you need me to do @zeroasterisk @whitlockjc ? |
|
Please move this PR to the new samples repo here https://github.com/google-a2a/a2a-samples |
…ject#52) * make core types gob-serializable * in-memory task store * task update logic * concurrent task execution and cancelation management * taskexec integration with default request handler * prevent possibility of failed cancelation destroying the queue which active execution uses for events * comments and t.Helper() calls * lint * artifact update logic * OnSendMessageStream() and tests * test and fix * PR review improvements * fix blocking on nil channel and empty yield(nil, nil) in defer * lint * refactor messages * restructure and add a test case * fix race condition
🤖 I have created a release *beep* *boop* --- ## 0.3.0 (2025-11-04) ### Features * add JSON-RPC client transport implementation ([a2aproject#79](a2aproject/a2a-go#79)) ([1690088](a2aproject/a2a-go@1690088)) * agent card resolver ([a2aproject#48](a2aproject/a2a-go#48)) ([0951293](a2aproject/a2a-go@0951293)) * blocking flag handling ([a2aproject#97](a2aproject/a2a-go#97)) ([f7aa465](a2aproject/a2a-go@f7aa465)), closes [a2aproject#96](a2aproject/a2a-go#96) * client API proposal ([a2aproject#32](a2aproject/a2a-go#32)) ([b6ca54f](a2aproject/a2a-go@b6ca54f)) * client auth interceptor ([a2aproject#90](a2aproject/a2a-go#90)) ([25b9aae](a2aproject/a2a-go@25b9aae)) * client interceptor invocations ([#51](a2aproject/a2a-go#51)) ([3e9f2ae](a2aproject/a2a-go@3e9f2ae)) * core types JSON codec ([a2aproject#42](a2aproject/a2a-go#42)) ([c5b3982](a2aproject/a2a-go@c5b3982)) * define core types and interfaces ([a2aproject#16](a2aproject/a2a-go#16)) ([69b96ea](a2aproject/a2a-go@69b96ea)) * disallow custom types and circular refs in Metadata ([a2aproject#43](a2aproject/a2a-go#43)) ([53bc928](a2aproject/a2a-go@53bc928)) * get task implementation ([a2aproject#59](a2aproject/a2a-go#59)) ([f74d854](a2aproject/a2a-go@f74d854)) * grpc authenticated agent card and producer utils ([a2aproject#85](a2aproject/a2a-go#85)) ([9d82f31](a2aproject/a2a-go@9d82f31)), closes [a2aproject#82](a2aproject/a2a-go#82) * grpc client transport ([#66](a2aproject/a2a-go#66)) ([fee703e](a2aproject/a2a-go@fee703e)) * grpc code generation from A2A .proto spec ([a2aproject#11](a2aproject/a2a-go#11)) ([2993b98](a2aproject/a2a-go@2993b98)) * handling artifacts and implementing send message stream ([a2aproject#52](a2aproject/a2a-go#52)) ([c3fa631](a2aproject/a2a-go@c3fa631)) * implement an a2aclient.Factory ([a2aproject#50](a2aproject/a2a-go#50)) ([49deee7](a2aproject/a2a-go@49deee7)) * implementing grpc server wrapper ([a2aproject#37](a2aproject/a2a-go#37)) ([071e952](a2aproject/a2a-go@071e952)) * implementing message-message interaction ([a2aproject#34](a2aproject/a2a-go#34)) ([b568979](a2aproject/a2a-go@b568979)) * implementing task pushes ([a2aproject#86](a2aproject/a2a-go#86)) ([c210240](a2aproject/a2a-go@c210240)) * input-required and auth-required handling ([a2aproject#70](a2aproject/a2a-go#70)) ([3ac89ba](a2aproject/a2a-go@3ac89ba)) * jsonrpc server ([a2aproject#91](a2aproject/a2a-go#91)) ([5491030](a2aproject/a2a-go@5491030)) * logger ([a2aproject#56](a2aproject/a2a-go#56)) ([86ab9d2](a2aproject/a2a-go@86ab9d2)) * request context loading ([a2aproject#60](a2aproject/a2a-go#60)) ([ab7a29b](a2aproject/a2a-go@ab7a29b)) * result aggregation part 1 - task store ([a2aproject#38](a2aproject/a2a-go#38)) ([d3c02f5](a2aproject/a2a-go@d3c02f5)) * result aggregation part 3 - concurrent task executor ([a2aproject#40](a2aproject/a2a-go#40)) ([265c3e7](a2aproject/a2a-go@265c3e7)) * result aggregation part 4 - integration ([a2aproject#41](a2aproject/a2a-go#41)) ([bab72d9](a2aproject/a2a-go@bab72d9)) * SDK type utilities ([a2aproject#31](a2aproject/a2a-go#31)) ([32b77b4](a2aproject/a2a-go@32b77b4)) * server middleware API ([a2aproject#63](a2aproject/a2a-go#63)) ([738bf85](a2aproject/a2a-go@738bf85)) * server middleware integration ([a2aproject#64](a2aproject/a2a-go#64)) ([5dc8be0](a2aproject/a2a-go@5dc8be0)) * smarter a2aclient ([a2aproject#88](a2aproject/a2a-go#88)) ([322d05b](a2aproject/a2a-go@322d05b)) * task event factory ([a2aproject#95](a2aproject/a2a-go#95)) ([fbf3bcf](a2aproject/a2a-go@fbf3bcf)), closes [#84](a2aproject/a2a-go#84) * task executor docs ([a2aproject#36](a2aproject/a2a-go#36)) ([b6868df](a2aproject/a2a-go@b6868df)) * task update logic ([0ac987f](a2aproject/a2a-go@0ac987f)) ### Bug Fixes * Execute() callers missing events ([a2aproject#74](a2aproject/a2a-go#74)) ([4c3389f](a2aproject/a2a-go@4c3389f)) * mark task failed when execution fails ([a2aproject#94](a2aproject/a2a-go#94)) ([ee0e7ed](a2aproject/a2a-go@ee0e7ed)) * push semantics update ([a2aproject#93](a2aproject/a2a-go#93)) ([76bff9f](a2aproject/a2a-go@76bff9f)) * race detector queue closed access ([c07b7d0](a2aproject/a2a-go@c07b7d0)) * regenerate proto and update converters ([#81](a2aproject/a2a-go#81)) ([c732060](a2aproject/a2a-go@c732060)) * streaming ([a2aproject#92](a2aproject/a2a-go#92)) ([ca7a64b](a2aproject/a2a-go@ca7a64b)) ### Miscellaneous Chores * release 0.3.0 ([fa7cfba](a2aproject/a2a-go@fa7cfba)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Okay, I got very caffeinated and decided we need something in Golang, because this was the only way I could wrap my head around this. The PR introduces a Go implementation of the Agent-to-Agent (A2A) protocol, focusing on the core server and client components. It does not yet cover additional golang agents ( I'll do that in another PR if you accept this ).
CLA signed...
Changes
Server Implementation
Implemented a JSON-RPC 2.0 server/client
Added support for core A2A methods:
tasks/send: Send new tasks
tasks/get: Retrieve task status
tasks/cancel: Cancel running tasks
Implemented thread-safe task storage
Error handling with A2A error codes etc
Created extensive test coverage for server functionality
Client Implementation
support for all core A2A methods
Created test suite for client (Thanks Copilot 👍)
Models Package
Defined type-safe structures for:
Task management
Error handling
Implemented JSON serialization/deserialization
Added validation for all data structures
Added streaming support
Documentation
Created README files for:
Server package
Client package
Models package
Added usage examples and API documentation
Included testing instructions
Pending Work
Agent implementation is not included in this PR and will be addressed in a future update
The current implementation focuses on the core protocol and infrastructure
Agent-specific functionality (like skill execution, capability negotiation, etc.) will be implemented separately.