[Feat]: Generate Pydantic models from proto definition for Python-idiomatic validation for A2A Version 1.0.x
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Lĩnh vực
- backend-api-design, tooling
Hướng nghiên cứu
Issue này là về việc tạo các model Pydantic từ tệp a2a.proto. Hãy xem pipeline build hiện có (có khả năng sử dụng buf và protoc) trong repository. Nghiên cứu các công cụ như protobuf-to-pydantic. Công việc bao gồm sửa đổi hệ thống build để tạo thêm một artifact. 'Done' có nghĩa là các model Pydantic được tạo ra được phát hành trong package SDK cùng với các kiểu proto.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Is your feature request related to a problem? Please describe.
The migration to protobuf-generated types (PR #572) removes Pydantic models entirely from the SDK. While using a2a.proto as the single source of truth is the correct architectural decision, the removal of Pydantic models creates a significant developer experience gap for the Python ecosystem.
The problem:
-
FastAPI, the most widely used Python web framework for building AI/agent services, uses Pydantic natively for request validation, serialization, OpenAPI schema generation, and error reporting. Proto objects don't integrate with any of this. Developers lose automatic validation, clear error messages, .model_dump(), .model_validate(), union discriminators, and Field() defaults.
-
Protobuf objects in Python are not idiomatic. WhichOneof(), HasField(), CopyFrom(), MessageToDict()/ParseDict() are foreign patterns to Python developers building agents with LangChain, CrewAI, or custom FastAPI services. Proto3 has no required fields, so ParseDict({}, SendMessageRequest()) succeeds silently with an empty object, providing no validation at all.
-
The v0.3.0 Pydantic types (generated from the OpenAPI spec via datamodel-codegen) were well-received and widely adopted. Multiple community frameworks depend on them for HTTP-layer validation. Removing them without replacement forces every downstream project to either vendor their own type definitions or wrap proto objects with manual validation boilerplate.
-
This is visible in the issue tracker right now: #876 "SDK doesn't validate proto..." and #856 "Server does not validate..." are direct consequences of losing Pydantic's validation layer.
Describe the solution you'd like
Generate Pydantic models from the proto definition as an additional build artifact, alongside the existing proto-generated types. Both would be published in the SDK package.
Concretely:
-
a2a.types.proto (or a2a.grpc): Proto-generated types from a2a_pb2, as implemented in PR #572. Used by gRPC transport and anyone who prefers proto-native patterns.
-
a2a.types (or a2a.types.models): Pydantic models generated from the same a2a.proto source. Used for HTTP/JSON validation, FastAPI integration, and Python-idiomatic development.
Generation can be automated via protobuf-to-pydantic, custom protoc plugin, or a build script that derives Pydantic models from the OpenAPI/JSON schema (which is already generated from the proto via buf). The key point: a2a.proto remains the single source of truth. The Pydantic models are a generated artifact, not a manually maintained parallel type system.
This is not an either/or decision. The proto types serve gRPC consumers well. The Pydantic types serve the HTTP/JSON/FastAPI ecosystem. Both are generated from the same source, stay in sync automatically, and serve different transport layers of the same protocol.
The cost is one additional codegen step in the build pipeline. The benefit is that the Python SDK remains usable for the majority of Python agent developers who build on FastAPI/Pydantic.
Describe alternatives you've considered
No response
Additional context
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
- Ngôn ngữ chính
- Python
- Star
- 2.2k
- Fork
- 509
- Merge trung bình
- 3 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 43
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của a2aproject/a2a-python
-
[Bug]: REST task/request id sanitizationCó thể đã có người làm @Linux2010 đã nhận 102 ngày trước. Đang mởmaintainers-only
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
a2aproject/a2a-python#805 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: After a streamed task is cancelled, its background producer never finishesCó thể đã có người làm @rohityan đã nhận 1 ngày trước. Đang mở
a2aproject/a2a-python#1322 · 2 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
v0.3 gRPC and REST SendMessage without configuration run non-blockingCó thể đã có người làm @rohityan đã nhận 1 ngày trước. Đang mở
a2aproject/a2a-python#1321 · 2 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug]: Push notification store failure rewrites a completed task as FAILED (DefaultRequestHandlerV2)Có thể đã có người làm @rohityan đã nhận 3 ngày trước. Đang mở
a2aproject/a2a-python#1313 · 2 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
v0.3 JSON-RPC and REST GetTask return no history when history_length is 0Có thể đã có người làm @rohityan đã nhận 3 ngày trước. Đang mở
a2aproject/a2a-python#1311 · 2 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của a2aproject/a2a-python
Issue tương tự
-
Link Checker ReportĐang mởautomated issue report
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
RapidAI/RapidOCRDocs#119 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
btclib-org/btclib-node#1833 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
IRIS reader: no-data velocity bins (DB_VEL, DB_VELC) returned as 0.0 m/s instead of NaNCó thể đã có người làm @syedhamidali đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
elodin-sys/elodin#890 ·
Maintainer thường phản hồi trong vòng 1 ngày