a2aproject / a2aproject/a2a-dotnet

Refactor agent method implementations to allow extension and custom methods

Đang mở
#169 3 bình luận 0 reaction 1 người được giao Được @rokonec nhận Xem trên GitHub
Ngôn ngữ chính
C#
Star
262
Fork
64
Merge trung bình
5 ngày 2 giờ
Pull request đã merge (30 ngày)
31

Mô tả

## Description

The [3.5. Method Mapping and Naming Conventions](https://a2a-protocol.org/latest/specification/#35-method-mapping-and-naming-conventions) section of the specification defines conventions for JSON-RPC/gRPC/REST methods mapping and defines existence of custom or extensions methods.

Currently, the handlers for the same methods for different transports are implemented on different places taking information from ad-hoc source locations and custom or extension methods are not supported, see [JSON-RPC server implementation](https://github.com/a2aproject/a2a-dotnet/blob/f2856b721df64b01ac7b2a5852956ce96c58104e/src/A2A.AspNetCore/A2AJsonRpcProcessor.cs#L81) vs. [JSON-RPC client implementation](https://github.com/a2aproject/a2a-dotnet/blob/f2856b721df64b01ac7b2a5852956ce96c58104e/src/A2A/Client/A2AClient.cs#L164) vs. [REST implementation](https://github.com/a2aproject/a2a-dotnet/blob/f2856b721df64b01ac7b2a5852956ce96c58104e/src/A2A.AspNetCore/A2AEndpointRouteBuilderExtensions.cs#L77). gRPC method handlers does not seem to be implemented either?

Within this task, propose a way how to abstract all information needed to serve and handle requests to agent methods (including custom or extension ones) for all supported transports so adding a new method will be matter of deriving single abstract class and its registration without the necessity of changing transport-specific handlers implementations on multiple places.

NOTE: [Command](https://www.geeksforgeeks.org/system-design/command-pattern/) or similar design-pattern can be utilized for this.

NOTE: Adding support for custom or extension methods might involve adding a new method to [A2AEndpointRouteBuilderExtensions.cs](https://github.com/a2aproject/a2a-dotnet/blob/f2856b721df64b01ac7b2a5852956ce96c58104e/src/A2A.AspNetCore/A2AEndpointRouteBuilderExtensions.cs) or adding a new parameter to [A2AEndpointRouteBuilderExtensions.MapA2A()](https://github.com/a2aproject/a2a-dotnet/blob/f2856b721df64b01ac7b2a5852956ce96c58104e/src/A2A.AspNetCore/A2AEndpointRouteBuilderExtensions.cs#L29) that will allow defining the custom methods. Alternatively, similar concept as [TaskManager](https://github.com/a2aproject/a2a-dotnet/blob/f2856b721df64b01ac7b2a5852956ce96c58104e/src/A2A/Server/TaskManager.cs#L15) can be introduced to manage custom methods implementations.

## Motivation

- Reduce code duplication and improve architecture of the library (open-close principle).
- Enable user-defined custom or extensions methods implemented using the same mechanisms as built-in methods are.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Examine the current method handler implementations in A2AJsonRpcProcessor.cs, A2AClient.cs, and A2AEndpointRouteBuilderExtensions.cs. Understand the Command pattern and how it could abstract method information. Investigate the TaskManager class as a potential model. The goal is to design a unified abstraction that allows new methods via a single class derivation, without modifying transport-specific handlers.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
csharp, grpc, json
Lĩnh vực
api, backend, devtools
Loại issue
Tái cấu trúc
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.