5555]
5656
5757
58- class ClientFactory :
59- """ClientFactory is used to generate the appropriate client for the agent.
58+ class A2AClientFactory :
59+ """A2AClientFactory is used to generate the appropriate client for the agent.
6060
6161 The factory is configured with a `ClientConfig` and optionally a list of
6262 `Consumer`s to use for all generated `Client`s. The expected use is:
6363
6464 .. code-block:: python
6565
66- factory = ClientFactory (config, consumers)
66+ factory = A2AClientFactory (config, consumers)
6767 # Optionally register custom client implementations
6868 factory.register('my_customer_transport', NewCustomTransportClient)
6969 # Then with an agent card make a client with additional consumers and
@@ -101,7 +101,7 @@ def jsonrpc_transport_producer(
101101 url : str ,
102102 config : ClientConfig ,
103103 ) -> ClientTransport :
104- interface = ClientFactory ._find_best_interface (
104+ interface = A2AClientFactory ._find_best_interface (
105105 list (card .supported_interfaces ),
106106 protocol_bindings = [TransportProtocol .JSONRPC ],
107107 url = url ,
@@ -140,7 +140,7 @@ def rest_transport_producer(
140140 url : str ,
141141 config : ClientConfig ,
142142 ) -> ClientTransport :
143- interface = ClientFactory ._find_best_interface (
143+ interface = A2AClientFactory ._find_best_interface (
144144 list (card .supported_interfaces ),
145145 protocol_bindings = [TransportProtocol .HTTP_JSON ],
146146 url = url ,
@@ -186,7 +186,7 @@ def grpc_transport_producer(
186186 ) -> ClientTransport :
187187 # The interface has already been selected and passed as `url`.
188188 # We determine its version to use the appropriate transport implementation.
189- interface = ClientFactory ._find_best_interface (
189+ interface = A2AClientFactory ._find_best_interface (
190190 list (card .supported_interfaces ),
191191 protocol_bindings = [TransportProtocol .GRPC ],
192192 url = url ,
@@ -278,13 +278,13 @@ async def connect( # noqa: PLR0913
278278
279279 Constructs a client that connects to the specified agent. Note that
280280 creating multiple clients via this method is less efficient than
281- constructing an instance of ClientFactory and reusing that.
281+ constructing an instance of A2AClientFactory and reusing that.
282282
283283 .. code-block:: python
284284
285285 # This will search for an AgentCard at /.well-known/agent-card.json
286286 my_agent_url = 'https://travel.agents.example.com'
287- client = await ClientFactory .connect(my_agent_url)
287+ client = await A2AClientFactory .connect(my_agent_url)
288288
289289
290290 Args:
@@ -364,7 +364,7 @@ def create(
364364 selected_interface = None
365365 if self ._config .use_client_preference :
366366 for protocol_binding in client_set :
367- selected_interface = ClientFactory ._find_best_interface (
367+ selected_interface = A2AClientFactory ._find_best_interface (
368368 list (card .supported_interfaces ),
369369 protocol_bindings = [protocol_binding ],
370370 )
@@ -375,7 +375,7 @@ def create(
375375 for supported_interface in card .supported_interfaces :
376376 if supported_interface .protocol_binding in client_set :
377377 transport_protocol = supported_interface .protocol_binding
378- selected_interface = ClientFactory ._find_best_interface (
378+ selected_interface = A2AClientFactory ._find_best_interface (
379379 list (card .supported_interfaces ),
380380 protocol_bindings = [transport_protocol ],
381381 )
@@ -432,3 +432,6 @@ def minimal_agent_card(
432432 version = '' ,
433433 name = '' ,
434434 )
435+
436+
437+ ClientFactory = A2AClientFactory
0 commit comments