microsoft-agents-hosting-core 0.7.0.dev1__py3-none-any.whl → 0.7.0.dev4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -341,6 +341,19 @@ class ChannelServiceAdapter(ChannelAdapter, ABC):
341
341
  await connector_client.close()
342
342
  await user_token_client.close()
343
343
 
344
+ def _resolve_if_connector_client_is_needed(self, activity: Activity) -> bool:
345
+ """Determine if a connector client is needed based on the activity's delivery mode and service URL.
346
+
347
+ :param activity: The activity to evaluate.
348
+ :type activity: :class:`microsoft_agents.activity.Activity`
349
+ """
350
+ if activity.delivery_mode in [
351
+ DeliveryModes.expect_replies,
352
+ DeliveryModes.stream,
353
+ ]:
354
+ return False
355
+ return True
356
+
344
357
  async def process_activity(
345
358
  self,
346
359
  claims_identity: ClaimsIdentity,
@@ -403,21 +416,24 @@ class ChannelServiceAdapter(ChannelAdapter, ABC):
403
416
  context.turn_state[self.USER_TOKEN_CLIENT_KEY] = user_token_client
404
417
 
405
418
  # Create the connector client to use for outbound requests.
406
- connector_client: ConnectorClient = (
407
- await self._channel_service_client_factory.create_connector_client(
408
- context,
409
- claims_identity,
410
- activity.service_url,
411
- outgoing_audience,
412
- scopes,
413
- use_anonymous_auth_callback,
419
+ connector_client: Optional[ConnectorClient] = None
420
+ if self._resolve_if_connector_client_is_needed(activity):
421
+ connector_client = (
422
+ await self._channel_service_client_factory.create_connector_client(
423
+ context,
424
+ claims_identity,
425
+ activity.service_url,
426
+ outgoing_audience,
427
+ scopes,
428
+ use_anonymous_auth_callback,
429
+ )
414
430
  )
415
- )
416
- context.turn_state[self._AGENT_CONNECTOR_CLIENT_KEY] = connector_client
431
+ context.turn_state[self._AGENT_CONNECTOR_CLIENT_KEY] = connector_client
417
432
 
418
433
  await self.run_pipeline(context, callback)
419
434
 
420
- await connector_client.close()
435
+ if connector_client:
436
+ await connector_client.close()
421
437
  await user_token_client.close()
422
438
 
423
439
  # If there are any results they will have been left on the TurnContext.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: microsoft-agents-hosting-core
3
- Version: 0.7.0.dev1
3
+ Version: 0.7.0.dev4
4
4
  Summary: Core library for Microsoft Agents
5
5
  Author: Microsoft Corporation
6
6
  License-Expression: MIT
@@ -15,7 +15,7 @@ Classifier: Operating System :: OS Independent
15
15
  Requires-Python: >=3.10
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
- Requires-Dist: microsoft-agents-activity==0.7.0.dev1
18
+ Requires-Dist: microsoft-agents-activity==0.7.0.dev4
19
19
  Requires-Dist: pyjwt>=2.10.1
20
20
  Requires-Dist: isodate>=0.6.1
21
21
  Requires-Dist: azure-core>=1.30.0
@@ -4,7 +4,7 @@ microsoft_agents/hosting/core/agent.py,sha256=K8v84y8ULP7rbcMKg8LxaM3haAq7f1oHFC
4
4
  microsoft_agents/hosting/core/card_factory.py,sha256=UDmPEpOk2SpEr9ShN9Q0CiaI_GTD3qjHgkDMOWinW9I,6926
5
5
  microsoft_agents/hosting/core/channel_adapter.py,sha256=MqES9gHGS0nrKBR7u8zLQCsuIksl-hScZy_jg4LTTHo,10669
6
6
  microsoft_agents/hosting/core/channel_api_handler_protocol.py,sha256=RO59hiOYx7flQVWhX6VGvfpFPoKVkdT_la-7WhUl8UM,4506
7
- microsoft_agents/hosting/core/channel_service_adapter.py,sha256=OTF1EFycfBv4sdX2Zt_jPzk80aRHjLhSv5DyU6CEc7Q,20919
7
+ microsoft_agents/hosting/core/channel_service_adapter.py,sha256=L3XQQSnWuF-8_1MAyZTsI7RRn9TfYv0UW1Dj6nyOuAQ,21598
8
8
  microsoft_agents/hosting/core/channel_service_client_factory_base.py,sha256=9LcpxiWMXmWAdGQt6lRzvY9ybF_5mGc5Focd1Z7f9MY,1711
9
9
  microsoft_agents/hosting/core/message_factory.py,sha256=F9QJBF4yBupHXxOW984ZzZomVEG57t9IUnTHwub-lX0,7822
10
10
  microsoft_agents/hosting/core/middleware_set.py,sha256=TBsBs4KwAfKyHlQTlG4bl1y5UjkBzeMDs5w7LNB-Bi4,2585
@@ -102,8 +102,8 @@ microsoft_agents/hosting/core/storage/transcript_info.py,sha256=5VN32j99tshChAff
102
102
  microsoft_agents/hosting/core/storage/transcript_logger.py,sha256=_atDk3CJ05fIVMhlWGNa91IiM9bGLmOhasFko8Lxjhk,8237
103
103
  microsoft_agents/hosting/core/storage/transcript_memory_store.py,sha256=v1Ud9LSs8m5c9_Fa8i49SuAjw80dX1hDciqbRduDEOE,6444
104
104
  microsoft_agents/hosting/core/storage/transcript_store.py,sha256=ka74o0WvI5GhMZcFqSxVdamBhGzZcDZe6VNkG-sMy74,1944
105
- microsoft_agents_hosting_core-0.7.0.dev1.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
106
- microsoft_agents_hosting_core-0.7.0.dev1.dist-info/METADATA,sha256=uTABUKgX0loiJoQtHm-MQVfr7QrmbtqyoRyl7zeLf-8,9242
107
- microsoft_agents_hosting_core-0.7.0.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
108
- microsoft_agents_hosting_core-0.7.0.dev1.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
109
- microsoft_agents_hosting_core-0.7.0.dev1.dist-info/RECORD,,
105
+ microsoft_agents_hosting_core-0.7.0.dev4.dist-info/licenses/LICENSE,sha256=ws_MuBL-SCEBqPBFl9_FqZkaaydIJmxHrJG2parhU4M,1141
106
+ microsoft_agents_hosting_core-0.7.0.dev4.dist-info/METADATA,sha256=p3_XQtKWH-QkdDbgeN6iSZYLZLyRwwH831hIC0TWsj8,9242
107
+ microsoft_agents_hosting_core-0.7.0.dev4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
108
+ microsoft_agents_hosting_core-0.7.0.dev4.dist-info/top_level.txt,sha256=lWKcT4v6fTA_NgsuHdNvuMjSrkiBMXohn64ApY7Xi8A,17
109
+ microsoft_agents_hosting_core-0.7.0.dev4.dist-info/RECORD,,