2020 if TYPE_CHECKING :
2121
2222 class Channel : # type: ignore[no-redef]
23- pass
23+ """Dummy class for type hinting when grpc.aio is not available."""
24+
2425 else :
2526 Channel = None # At runtime, pd will be None if the import failed.
2627
@@ -188,11 +189,24 @@ class ClientConfig:
188189
189190
190191class Client (ABC ):
192+ """Abstract base class defining the interface for an A2A client.
193+
194+ This class provides a standard set of methods for interacting with an A2A
195+ agent, regardless of the underlying transport protocol (e.g., gRPC, JSON-RPC).
196+ It supports sending messages, managing tasks, and handling event streams.
197+ """
198+
191199 def __init__ (
192200 self ,
193201 consumers : list [Consumer ] | None = None ,
194202 middleware : list [ClientCallInterceptor ] | None = None ,
195203 ):
204+ """Initializes the client with consumers and middleware.
205+
206+ Args:
207+ consumers: A list of callables to process events from the agent.
208+ middleware: A list of interceptors to process requests and responses.
209+ """
196210 if middleware is None :
197211 middleware = []
198212 if consumers is None :
@@ -224,7 +238,7 @@ async def get_task(
224238 * ,
225239 context : ClientCallContext | None = None ,
226240 ) -> Task :
227- pass
241+ """Retrieves the current state and history of a specific task."""
228242
229243 @abstractmethod
230244 async def cancel_task (
@@ -233,7 +247,7 @@ async def cancel_task(
233247 * ,
234248 context : ClientCallContext | None = None ,
235249 ) -> Task :
236- pass
250+ """Requests the agent to cancel a specific task."""
237251
238252 @abstractmethod
239253 async def set_task_callback (
@@ -242,7 +256,7 @@ async def set_task_callback(
242256 * ,
243257 context : ClientCallContext | None = None ,
244258 ) -> TaskPushNotificationConfig :
245- pass
259+ """Sets or updates the push notification configuration for a specific task."""
246260
247261 @abstractmethod
248262 async def get_task_callback (
@@ -251,7 +265,7 @@ async def get_task_callback(
251265 * ,
252266 context : ClientCallContext | None = None ,
253267 ) -> TaskPushNotificationConfig :
254- pass
268+ """Retrieves the push notification configuration for a specific task."""
255269
256270 @abstractmethod
257271 async def resubscribe (
@@ -260,13 +274,14 @@ async def resubscribe(
260274 * ,
261275 context : ClientCallContext | None = None ,
262276 ) -> AsyncIterator [Task | Message ]:
277+ """Resubscribes to a task's event stream."""
263278 yield
264279
265280 @abstractmethod
266281 async def get_card (
267282 self , * , context : ClientCallContext | None = None
268283 ) -> AgentCard :
269- pass
284+ """Retrieves the agent's card."""
270285
271286 async def add_event_consumer (self , consumer : Consumer ) -> None :
272287 """Attaches additional consumers to the `Client`."""
0 commit comments