@@ -47,8 +47,10 @@ async def send_message(
4747 self ,
4848 request : Message ,
4949 * ,
50+ configuration : MessageSendConfiguration | None = None ,
5051 context : ClientCallContext | None = None ,
5152 request_metadata : dict [str , Any ] | None = None ,
53+ extensions : list [str ] | None = None ,
5254 ) -> AsyncIterator [ClientEvent | Message ]:
5355 """Sends a message to the agent.
5456
@@ -58,13 +60,15 @@ async def send_message(
5860
5961 Args:
6062 request: The message to send to the agent.
63+ configuration: Optional per-call overrides for message sending behavior.
6164 context: The client call context.
6265 request_metadata: Extensions Metadata attached to the request.
66+ extensions: List of extensions to be activated.
6367
6468 Yields:
6569 An async iterator of `ClientEvent` or a final `Message` response.
6670 """
67- config = MessageSendConfiguration (
71+ base_config = MessageSendConfiguration (
6872 accepted_output_modes = self ._config .accepted_output_modes ,
6973 blocking = not self ._config .polling ,
7074 push_notification_config = (
@@ -73,13 +77,22 @@ async def send_message(
7377 else None
7478 ),
7579 )
80+ if configuration is not None :
81+ update_data = configuration .model_dump (
82+ exclude_unset = True ,
83+ by_alias = False ,
84+ )
85+ config = base_config .model_copy (update = update_data )
86+ else :
87+ config = base_config
88+
7689 params = MessageSendParams (
7790 message = request , configuration = config , metadata = request_metadata
7891 )
7992
8093 if not self ._config .streaming or not self ._card .capabilities .streaming :
8194 response = await self ._transport .send_message (
82- params , context = context
95+ params , context = context , extensions = extensions
8396 )
8497 result = (
8598 (response , None ) if isinstance (response , Task ) else response
@@ -89,7 +102,9 @@ async def send_message(
89102 return
90103
91104 tracker = ClientTaskManager ()
92- stream = self ._transport .send_message_streaming (params , context = context )
105+ stream = self ._transport .send_message_streaming (
106+ params , context = context , extensions = extensions
107+ )
93108
94109 first_event = await anext (stream )
95110 # The response from a server may be either exactly one Message or a
@@ -126,74 +141,91 @@ async def get_task(
126141 request : TaskQueryParams ,
127142 * ,
128143 context : ClientCallContext | None = None ,
144+ extensions : list [str ] | None = None ,
129145 ) -> Task :
130146 """Retrieves the current state and history of a specific task.
131147
132148 Args:
133149 request: The `TaskQueryParams` object specifying the task ID.
134150 context: The client call context.
151+ extensions: List of extensions to be activated.
135152
136153 Returns:
137154 A `Task` object representing the current state of the task.
138155 """
139- return await self ._transport .get_task (request , context = context )
156+ return await self ._transport .get_task (
157+ request , context = context , extensions = extensions
158+ )
140159
141160 async def cancel_task (
142161 self ,
143162 request : TaskIdParams ,
144163 * ,
145164 context : ClientCallContext | None = None ,
165+ extensions : list [str ] | None = None ,
146166 ) -> Task :
147167 """Requests the agent to cancel a specific task.
148168
149169 Args:
150170 request: The `TaskIdParams` object specifying the task ID.
151171 context: The client call context.
172+ extensions: List of extensions to be activated.
152173
153174 Returns:
154175 A `Task` object containing the updated task status.
155176 """
156- return await self ._transport .cancel_task (request , context = context )
177+ return await self ._transport .cancel_task (
178+ request , context = context , extensions = extensions
179+ )
157180
158181 async def set_task_callback (
159182 self ,
160183 request : TaskPushNotificationConfig ,
161184 * ,
162185 context : ClientCallContext | None = None ,
186+ extensions : list [str ] | None = None ,
163187 ) -> TaskPushNotificationConfig :
164188 """Sets or updates the push notification configuration for a specific task.
165189
166190 Args:
167191 request: The `TaskPushNotificationConfig` object with the new configuration.
168192 context: The client call context.
193+ extensions: List of extensions to be activated.
169194
170195 Returns:
171196 The created or updated `TaskPushNotificationConfig` object.
172197 """
173- return await self ._transport .set_task_callback (request , context = context )
198+ return await self ._transport .set_task_callback (
199+ request , context = context , extensions = extensions
200+ )
174201
175202 async def get_task_callback (
176203 self ,
177204 request : GetTaskPushNotificationConfigParams ,
178205 * ,
179206 context : ClientCallContext | None = None ,
207+ extensions : list [str ] | None = None ,
180208 ) -> TaskPushNotificationConfig :
181209 """Retrieves the push notification configuration for a specific task.
182210
183211 Args:
184212 request: The `GetTaskPushNotificationConfigParams` object specifying the task.
185213 context: The client call context.
214+ extensions: List of extensions to be activated.
186215
187216 Returns:
188217 A `TaskPushNotificationConfig` object containing the configuration.
189218 """
190- return await self ._transport .get_task_callback (request , context = context )
219+ return await self ._transport .get_task_callback (
220+ request , context = context , extensions = extensions
221+ )
191222
192223 async def resubscribe (
193224 self ,
194225 request : TaskIdParams ,
195226 * ,
196227 context : ClientCallContext | None = None ,
228+ extensions : list [str ] | None = None ,
197229 ) -> AsyncIterator [ClientEvent ]:
198230 """Resubscribes to a task's event stream.
199231
@@ -202,6 +234,7 @@ async def resubscribe(
202234 Args:
203235 request: Parameters to identify the task to resubscribe to.
204236 context: The client call context.
237+ extensions: List of extensions to be activated.
205238
206239 Yields:
207240 An async iterator of `ClientEvent` objects.
@@ -219,12 +252,15 @@ async def resubscribe(
219252 # we should never see Message updates, despite the typing of the service
220253 # definition indicating it may be possible.
221254 async for event in self ._transport .resubscribe (
222- request , context = context
255+ request , context = context , extensions = extensions
223256 ):
224257 yield await self ._process_response (tracker , event )
225258
226259 async def get_card (
227- self , * , context : ClientCallContext | None = None
260+ self ,
261+ * ,
262+ context : ClientCallContext | None = None ,
263+ extensions : list [str ] | None = None ,
228264 ) -> AgentCard :
229265 """Retrieves the agent's card.
230266
@@ -233,11 +269,14 @@ async def get_card(
233269
234270 Args:
235271 context: The client call context.
272+ extensions: List of extensions to be activated.
236273
237274 Returns:
238275 The `AgentCard` for the agent.
239276 """
240- card = await self ._transport .get_card (context = context )
277+ card = await self ._transport .get_card (
278+ context = context , extensions = extensions
279+ )
241280 self ._card = card
242281 return card
243282
0 commit comments