google / google/adk-python

RemoteA2aAgent resets A2AClientFactory

Ouverte
#3,158 2 commentaires 0 réactions 1 personne assignée Assignée à @seanzhou1023 Voir sur GitHub
a2a needs review
Langage dominant
Python
Étoiles
21.5k
Forks
4k
Merge moyen
1 j 14 h
PR mergées (30 j)
37

Description

`class RemoteA2aAgent(BaseAgent):` takes in an `a2a_client_factory: Optional[A2AClientFactory] = None` but within:
```
async def _ensure_httpx_client(self) -> httpx.AsyncClient:
```
it overwrites it:
```python
self._a2a_client_factory = A2AClientFactory(
config=dataclasses.replace(
self._a2a_client_factory._config,
httpx_client=self._httpx_client,
)
)
```
which means I can't sub-class it. This is an issue because I need to override the `create` of `A2AClientFactory`.

**Describe the solution you'd like**
Allow the user to provide an `A2AClientFactory` that will be called to create the `A2AClient`.

**Describe alternatives you've considered**
For now I've resolved to monkey patching, which is far from ideal.

**Additional context**
This is needed in the context of the A2A <> x402 implementation, to get `RemoteA2aAgent` working with the `x402` spec over `A2A`.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.