@@ -589,6 +589,14 @@ def __init__(
589589 def get_http_args (
590590 self , context : ClientCallContext
591591 ) -> dict [str , Any ] | None :
592+ """Extract HTTP-specific keyword arguments from the client call context.
593+
594+ Args:
595+ context: The client call context.
596+
597+ Returns:
598+ A dictionary of HTTP arguments, or None.
599+ """
592600 return context .state .get ('http_kwargs' , None ) if context else None
593601
594602 async def send_message (
@@ -597,6 +605,18 @@ async def send_message(
597605 * ,
598606 context : ClientCallContext | None = None ,
599607 ) -> AsyncIterator [Task | Message ]:
608+ """Send a message to the agent and consumes the response(s).
609+
610+ This method handles both blocking (non-streaming) and streaming responses
611+ based on the client configuration and agent capabilities.
612+
613+ Args:
614+ request: The message to send.
615+ context: The client call context.
616+
617+ Yields:
618+ The final message or task result from the agent.
619+ """
600620 config = MessageSendConfiguration (
601621 accepted_output_modes = self ._config .accepted_output_modes ,
602622 blocking = not self ._config .polling ,
@@ -648,6 +668,15 @@ async def get_task(
648668 * ,
649669 context : ClientCallContext | None = None ,
650670 ) -> Task :
671+ """Retrieve a task from the agent.
672+
673+ Args:
674+ request: Parameters to identify the task.
675+ context: The client call context.
676+
677+ Returns:
678+ The requested task.
679+ """
651680 return await self ._transport_client .get_task (
652681 request ,
653682 http_kwargs = self .get_http_args (context ),
@@ -660,6 +689,15 @@ async def cancel_task(
660689 * ,
661690 context : ClientCallContext | None = None ,
662691 ) -> Task :
692+ """Cancel an ongoing task on the agent.
693+
694+ Args:
695+ request: Parameters to identify the task to cancel.
696+ context: The client call context.
697+
698+ Returns:
699+ The task after the cancellation request.
700+ """
663701 return await self ._transport_client .cancel_task (
664702 request ,
665703 http_kwargs = self .get_http_args (context ),
@@ -672,6 +710,15 @@ async def set_task_callback(
672710 * ,
673711 context : ClientCallContext | None = None ,
674712 ) -> TaskPushNotificationConfig :
713+ """Set a push notification callback for a task.
714+
715+ Args:
716+ request: The push notification configuration to set.
717+ context: The client call context.
718+
719+ Returns:
720+ The configured task push notification configuration.
721+ """
675722 return await self ._transport_client .set_task_callback (
676723 request ,
677724 http_kwargs = self .get_http_args (context ),
@@ -684,6 +731,15 @@ async def get_task_callback(
684731 * ,
685732 context : ClientCallContext | None = None ,
686733 ) -> TaskPushNotificationConfig :
734+ """Retrieve the push notification callback configuration for a task.
735+
736+ Args:
737+ request: Parameters to identify the task and configuration.
738+ context: The client call context.
739+
740+ Returns:
741+ The requested task push notification configuration.
742+ """
687743 return await self ._transport_client .get_task_callback (
688744 request ,
689745 http_kwargs = self .get_http_args (context ),
@@ -696,6 +752,20 @@ async def resubscribe(
696752 * ,
697753 context : ClientCallContext | None = None ,
698754 ) -> AsyncIterator [Task | Message ]:
755+ """Resubscribe to a task's event stream.
756+
757+ This is only available if both the client and server support streaming.
758+
759+ Args:
760+ request: Parameters to identify the task to resubscribe to.
761+ context: The client call context.
762+
763+ Yields:
764+ Task events from the agent.
765+
766+ Raises:
767+ Exception: If streaming is not supported.
768+ """
699769 if not self ._config .streaming or not self ._card .capabilities .streaming :
700770 raise Exception (
701771 'client and/or server do not support resubscription.'
@@ -713,17 +783,28 @@ async def get_card(
713783 * ,
714784 context : ClientCallContext | None = None ,
715785 ) -> AgentCard :
786+ """Retrieve the agent's card.
787+
788+ This may involve fetching the public card first if not already available,
789+ and then fetching the authenticated extended card if supported and required.
790+
791+ Args:
792+ context: The client call context.
793+
794+ Returns:
795+ The agent's card.
796+ """
716797 return await self ._transport_client .get_card (
717798 http_kwargs = self .get_http_args (context ),
718799 context = context ,
719800 )
720801
721802
722- def NewRestfulClient (
803+ def NewRestfulClient ( # noqa: N802
723804 card : AgentCard ,
724805 config : ClientConfig ,
725806 consumers : list [Consumer ],
726807 middleware : list [ClientCallInterceptor ],
727808) -> Client :
728- """Generator for the `RestClient` implementation."""
809+ """Factory function for the `RestClient` implementation."""
729810 return RestClient (card , config , consumers , middleware )
0 commit comments