refactor: Update A2A protocol to align with spec revision#633
refactor: Update A2A protocol to align with spec revision#633kabir merged 1 commit intoa2aproject:mainfrom
Conversation
Summary of ChangesHello @ehsavoie, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant refactor of the A2A protocol to align with a revised specification. The core changes focus on improving the clarity and flexibility of the API by centralizing protocol version management, simplifying resource identification, and unifying data part structures. These updates are consistently applied across all client transports and associated tests, ensuring a cohesive and up-to-date implementation of the A2A protocol. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a significant refactoring to align the A2A protocol implementation with a recent specification revision. The changes are extensive, touching upon core data models, client/server implementations, and documentation. Key updates include renaming resubscribe to subscribeToTask, simplifying resource identifiers to flat IDs, restructuring Part types, and moving protocol versioning to the AgentInterface level. The changes are well-executed and consistent across the codebase. I've identified a few minor documentation inconsistencies and one potential issue in the gRPC stream handling logic that should be addressed.
transport/grpc/src/main/java/io/a2a/transport/grpc/handler/GrpcHandler.java
Outdated
Show resolved
Hide resolved
client/transport/spi/src/main/java/io/a2a/client/transport/spi/ClientTransport.java
Outdated
Show resolved
Hide resolved
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request is a significant and well-executed refactoring to align the A2A protocol implementation with a revised specification. The changes are extensive, touching many parts of the codebase, including client transports, tests, examples, and the gRPC specification itself. Key changes like moving the protocol version, simplifying resource identifiers, restructuring Part types, and renaming resubscribe to subscribeToTask have been applied consistently. The code quality is high, and the updates correctly reflect the new specification. I have one suggestion to improve code readability by encapsulating some logic in a helper method.
| io.a2a.grpc.TaskState state = response.getStatusUpdate().getStatus().getState(); | ||
| boolean isFinal = state == io.a2a.grpc.TaskState.TASK_STATE_CANCELED | ||
| || state == io.a2a.grpc.TaskState.TASK_STATE_COMPLETED | ||
| || state == io.a2a.grpc.TaskState.TASK_STATE_FAILED | ||
| || state == io.a2a.grpc.TaskState.TASK_STATE_REJECTED; | ||
| if (isFinal) { | ||
| responseObserver.onCompleted(); | ||
| } else { | ||
| subscription.request(1); | ||
| } |
There was a problem hiding this comment.
To improve readability and avoid duplicating logic, consider extracting the check for a final task state into a private helper method. The domain TaskState enum already has an isFinal() method, and creating a similar utility for the gRPC TaskState enum would be beneficial.
For example:
private boolean isFinalState(io.a2a.grpc.TaskState state) {
return switch (state) {
case TASK_STATE_CANCELED,
TASK_STATE_COMPLETED,
TASK_STATE_FAILED,
TASK_STATE_REJECTED -> true;
default -> false;
};
}This would simplify the onNext method to:
if (response.hasStatusUpdate()) {
if (isFinalState(response.getStatusUpdate().getStatus().getState())) {
responseObserver.onCompleted();
} else {
subscription.request(1);
}
} else {
subscription.request(1);
}
jmesnil
left a comment
There was a problem hiding this comment.
/lgtm
I see there is now a tag for the spec https://github.com/a2aproject/A2A/releases/tag/v1.0.0-rc.
There is no change to the proto file that is copied in the PR so we can keep the one already there.
kabir
left a comment
There was a problem hiding this comment.
I think we need to align the spec model more with the proto changes
client/base/src/test/java/io/a2a/client/AuthenticationAuthorizationTest.java
Outdated
Show resolved
Hide resolved
...ort/jsonrpc/src/test/java/io/a2a/client/transport/jsonrpc/JSONRPCTransportStreamingTest.java
Outdated
Show resolved
Hide resolved
spec-grpc/src/main/java/io/a2a/grpc/mapper/AgentCardMapper.java
Outdated
Show resolved
Hide resolved
spec-grpc/src/main/java/io/a2a/grpc/mapper/AgentCardMapper.java
Outdated
Show resolved
Hide resolved
spec-grpc/src/main/java/io/a2a/grpc/mapper/AgentSkillMapper.java
Outdated
Show resolved
Hide resolved
spec-grpc/src/main/java/io/a2a/grpc/mapper/TaskStatusUpdateEventMapper.java
Outdated
Show resolved
Hide resolved
client/transport/grpc/src/main/java/io/a2a/client/transport/grpc/GrpcTransport.java
Show resolved
Hide resolved
spec-grpc/src/main/java/io/a2a/grpc/mapper/AuthenticationInfoMapper.java
Outdated
Show resolved
Hide resolved
0900704 to
1066250
Compare
- Move protocol version from AgentCard to AgentInterface level - Simplify resource identifiers from hierarchical names to flat IDs (e.g., "tasks/123" -> "123") - Restructure Part types: remove FilePart/DataPart in favor of unified Part with url/raw/data variants - Add OAuth flow support (ImplicitOAuthFlow, PasswordOAuthFlow) - Rename Security to SecurityRequirement for clarity - Standardize spelling: CANCELLED -> CANCELED - Update all client transports (gRPC, JSON-RPC, REST) and tests - Rename resubscribe to subscribeToTask Breaking changes in proto API affecting: - Task operations (get, cancel, subscribe) - Push notification config management - Message part structure Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Breaking changes in proto API affecting:
Fixes #632 🦕