fix: Retain the consumers and transport registry when recreating the ClientFactory in remote_a2a_agent.py

PiperOrigin-RevId: 807762203
This commit is contained in:
Google Team Member
2025-09-16 10:58:46 -07:00
committed by Copybara-Service
parent f7bd3c111c
commit 6bd33e1be3
2 changed files with 50 additions and 1 deletions
+5 -1
View File
@@ -188,12 +188,16 @@ class RemoteA2aAgent(BaseAgent):
)
self._httpx_client_needs_cleanup = True
if self._a2a_client_factory:
registry = self._a2a_client_factory._registry
self._a2a_client_factory = A2AClientFactory(
config=dataclasses.replace(
self._a2a_client_factory._config,
httpx_client=self._httpx_client,
)
),
consumers=self._a2a_client_factory._consumers,
)
for label, generator in registry.items():
self._a2a_client_factory.register(label, generator)
if not self._a2a_client_factory:
client_config = A2AClientConfig(
httpx_client=self._httpx_client,