-
Notifications
You must be signed in to change notification settings - Fork 107
docs: add AGENTS.md coding guide #596
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
base: main
Are you sure you want to change the base?
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 new, detailed guide for AI agents to understand and interact with the A2A Java SDK, covering its core components, development practices, and architectural patterns. Simultaneously, it vastly improves the documentation for the 'extras' modules, offering in-depth explanations and usage scenarios for implementing production-grade persistence and distributed event management solutions, thereby enabling developers to build more scalable and resilient A2A applications. Highlights
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces an excellent AGENTS.md coding guide, which will be a great resource for developers and AI agents working on this project. The guide is comprehensive and well-structured. Additionally, the extras/README.md has been significantly improved, providing much-needed clarity on the purpose and usage of the extras modules. My review includes a couple of suggestions to further enhance the documentation's clarity and consistency.
jmesnil
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.
I'm not a big agent user so take everything I commented with a grain of salt.
But this file looks like a SNAPSHOT of the content of this repo at this current time instead of explanation of what is the intent of that repo
| - **License**: Apache 2.0 | ||
| - **Repository**: https://github.com/a2aproject/a2a-java | ||
|
|
||
| ## Quick Start Guide |
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.
is that required in the AGENTS.md? It seems to be user doc (that should be in the README)
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.
Claude seemed to think so
|
|
||
| ## Architecture | ||
|
|
||
| ### Multi-Module Maven Project Structure |
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.
I'm not sure this file should contain a snapshot of the layout. The AI can figure it out.
It'd be better to state that the project uses a multi-module mven project structure and separates its different components based on their targets (server-side, client-side), transport and goals (eg reference server for tck)
313ba4e to
fd142c9
Compare
|
/Gemini review |
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.
Code Review
This pull request introduces a new AGENTS.md guide, which is a valuable addition for AI agents working with the codebase, providing essential context and coding guidelines. The extras/README.md has been significantly updated to offer a more comprehensive overview of the optional modules, greatly improving clarity for developers. The .gitignore updates are minor but correct. Overall, these changes enhance the project's documentation and maintainability.
| ### Code Quality Standards | ||
|
|
||
| - **Null Safety**: Uses JSpecify annotations and NullAway for compile-time null checking | ||
| - **Error Handling**: Custom error types extending `JSONRPCError` |
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.
The guide states that "Error Handling: Custom error types extending JSONRPCError". While JSONRPCError is a valid error type, the general rules for this project suggest that application-level errors should extend Exception or RuntimeException. The examples in the "Common Patterns in Codebase" section correctly show custom errors extending A2AError (which extends RuntimeException). Please clarify this statement to align with the general rules and the provided examples, emphasizing that A2AError should be the base for custom application-level errors, and JSONRPCError is for protocol-specific issues.
References
- Application-level errors should extend
ExceptionorRuntimeException, notjava.lang.Error.
| // BAD - Over-engineered | ||
| public String extractText(Message msg) { | ||
| return Optional.ofNullable(msg.parts()) | ||
| .orElse(Collections.emptyList()) | ||
| .stream() | ||
| .filter(TextPart.class::isInstance) | ||
| .map(TextPart.class::cast) | ||
| .map(TextPart::text) | ||
| .collect(Collectors.joining()); | ||
| } |
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.
In the "KISS (Keep It Simple, Stupid)" section, the "BAD - Over-engineered" example uses Optional.ofNullable and streams. While the "GOOD" example is indeed simpler for this specific case, labeling the stream-based approach as universally "BAD" might be too strong. This style can be beneficial and more readable in other, more complex scenarios. Consider rephrasing the comment to emphasize clarity for simple cases, rather than implying that stream-based operations are inherently over-engineered or bad practice.
extras/README.md
Outdated
| [`queue-manager-replicated`](./queue-manager-replicated/README.md) - Replaces the default `InMemoryQueueManager` with a `QueueManager` supporting replication to other A2A servers implementing the same agent. Required for multi-instance deployments. You can write your own `ReplicationStrategy`, or use the provided MicroProfile Reactive Messaging implementation with Apache Kafka, Pulsar, or AMQP. | ||
| ``` | ||
| ┌─────────────────────────────────────────────────────────────────────┐ | ||
| │ a2a-java-sdk-parent │ |
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.
The ASCII art diagram for "Module Dependencies" is a great visual aid. However, there's a minor typo in the parent POM name: a2a-java-sdk-parent should be a2a-java-sdk-parent. Also, the ◄─────SPI arrows are not standard ASCII characters and might not render correctly in all environments. Consider replacing them with standard ASCII characters or using a tool that generates diagrams directly from text (e.g., PlantUML, Mermaid) for better maintainability and consistent rendering.
| │ a2a-java-sdk-parent │ | |
| ┌─────────────────────────────────────────────────────────────────────┐ | |
| │ a2a-java-sdk-parent │ |
| - **`task-store-database-jpa`**: Depends on `server-common`, `jsonrpc-common`, and `extras/common` | ||
| - **`push-notification-config-store-database-jpa`**: Depends on `server-common` and `extras/common` | ||
| - **`queue-manager-replicated-core`**: Depends on `server-common`, `jsonrpc-common`, and `extras/common` | ||
| - **`replication-mp-reactive`**: Depends on `queue-manager-replicated-core` and MicroProfile Reactive Messaging |
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.
The dependency descriptions for task-store-database-jpa and queue-manager-replicated-core list jsonrpc-common as a dependency. It seems unusual for persistence and queue management modules to directly depend on a protocol-specific common module unless there's a clear, shared utility or data format requirement. This could introduce unnecessary coupling. Please verify if jsonrpc-common is strictly necessary for these modules. If not, consider refactoring to remove the dependency or move any truly shared utilities to a more general common module.
| <groupId>io.github.a2asdk</groupId> | ||
| <artifactId>a2a-java-sdk-http-client-vertx</artifactId> | ||
| </dependency> |
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.
The main README.md explicitly states that the groupId io.github.a2asdk is temporary and will likely change. This extras/README.md also uses this groupId in its examples but lacks the same temporary note. To maintain consistency and avoid confusion for users, please add a similar note about the temporary groupId here.
| <groupId>io.github.a2asdk</groupId> | |
| <artifactId>a2a-java-sdk-http-client-vertx</artifactId> | |
| </dependency> | |
| <!-- Add dependency - automatic discovery via ServiceLoader --> | |
| <!-- ⚠️ The `io.github.a2asdk` `groupId` below is temporary and will likely change for future releases. --> | |
| <dependency> |
Complete AI agent guide with quick start, architecture overview, coding principles (KISS/DRY), and enhanced extras module documentation. Fixes a2aproject#595 🦕 Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Provides examples and guidelines for AI-assisted coding.
Fixes #595 🦕