[Feat]: Support JSON-RPC Responses for Decoupled Pub/Sub Push Communication in Message-Driven Architectures

Abierto
#571 4 comentarios 3 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Revise la ruta HTTP 'POST' principal del SDK, probablemente en un archivo como server.py o routes.py, y los modelos de Pydantic para JSONRPCRequest y JSONRPCResponse. Comprenda cómo funciona actualmente la validación. La solución implica modificar la validación de entrada de la ruta para que acepte un tipo unión o crear un nuevo endpoint. Revise las pruebas existentes de la ruta para ver cómo añadir pruebas para el nuevo comportamiento.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Is your feature request related to a problem? Please describe.

The current implementation of the A2A Python SDK, when used as an agent in a message-driven architecture (e.g., handling requests pushed via Google Pub/Sub), only validates and accepts JSONRPCRequest objects on its primary HTTP 'POST' route.

In this architecture, an agent receives a request from a message broker (e.g., Pub/Sub push subscription), processes it, acknowledges the broker with a standard HTTP response, and sends the real, decoupled response back to the requesting service's inbound message queue.

If the requesting service is also an agent built with the same A2A Python SDK, it needs to receive a JSONRPCResponse. Since the receiving agent's primary 'POST' route strictly expects a JSONRPCRequest format via the Pydantic model validation, the inbound JSONRPCResponse is rejected, preventing the successful completion of the message exchange.

Describe the solution you'd like

We need to enable the SDK to correctly receive and process JSONRPCResponse objects on an agent, facilitating decoupled, asynchronous, push-based communication.

We propose discussing two possible solutions:

  1. Loosen Model Validation for Combined Input: Modify the Pydantic model validation on the main 'POST' route to accept a combined input of either a JSONRPCRequest or a JSONRPCResponse(e.g., checking against a union type like JSONRPCRequest | JSONRPCResponse). This would allow responses to be delivered via the existing primary request route.
  2. Introduce a Dedicated Response Route: Implement a new, dedicated HTTP endpoint (e.g., /response or /push_response) specifically for receiving and handling decoupled JSONRPCResponse objects.
Describe alternatives you've considered

No response

Additional context

This issue is critical for agents using the A2A Python SDK within environments where asynchronous, Pub/Sub push-based communication is the standard, as it currently blocks the ability to receive the final response successfully.

Code of Conduct
  • I agree to follow this project's Code of Conduct
Lenguaje dominante
Python
Estrellas
2.2k
Forks
496
Merge medio
3 d 15 h
PR fusionados (30 d)
20

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de a2aproject/a2a-python

Todos los issues de a2aproject/a2a-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.