[Feat]: Generate Pydantic models from proto definition for Python-idiomatic validation for A2A Version 1.0.x
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Ambito
- backend-api-design, tooling
Direzione di ricerca
L'issue riguarda la generazione di modelli Pydantic dal file a2a.proto. Esamina la pipeline di build esistente (probabilmente usando buf e protoc) nel repository. Cerca strumenti come protobuf-to-pydantic. Il lavoro consiste nel modificare il sistema di build per produrre un artefatto aggiuntivo. 'Done' significa che i modelli Pydantic generati vengono pubblicati nel pacchetto SDK insieme ai tipi proto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 2.2k
- Fork
- 499
- Merge medio
- 3g 20h
- PR unite (30g)
- 32
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di a2aproject/a2a-python
-
maintainers-only
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
a2aproject/a2a-python#805 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
v0.3 gRPC and REST SendMessage return no history when history_length is not setForse già presa @rohityan l’ha presa oggi. Aperta
a2aproject/a2a-python#1305 · 2 assegnatari ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: DefaultRequestHandlerV2 keeps the ActiveTask (producer, consumer, 2 dispatchers) alive forever after a direct Message or input-required responseForse già presa @rohityan l’ha presa 1 giorno fa. Aperta
a2aproject/a2a-python#1296 · 2 assegnatari ·
I maintainer di solito rispondono entro 1 giorno
-
[Feat]: Change Httpx to Httpx2Forse già presa @rohityan l’ha presa 2 giorni fa. Apertacomponent: client status: needs review
a2aproject/a2a-python#1288 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Streaming follow-up on an existing task does not begin with a Task; enqueuing the current task drops the follow-up message from historyForse già presa @rohityan l’ha presa 2 giorni fa. Apertacomponent: server status:awaiting response
a2aproject/a2a-python#1285 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di a2aproject/a2a-python
Issue simili
-
upstream update
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
conan-io/conan-center-index#31098 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
john-kurkowski/tldextract#382 ·
-
comp/tools duplicate P2 sweeper:risk-compatibility tool/mcp type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
NousResearch/hermes-agent#132042 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
deepset-ai/haystack#13092 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
feder-cr/invisible_playwright_mcp#1408 ·
I maintainer di solito rispondono entro 1 giorno