google / google/adk-python

RemoteA2aAgent resets A2AClientFactory

未关闭
#3,158 2 条评论 0 个 reaction 已指派 1 人 已指派给 @seanzhou1023 在 GitHub 查看
a2a needs review
主要语言
Python
星标
21.5k
派生
4k
平均合并
1 天 14 小时
30 天内合并 PR
37

描述

`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`.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。