microsoft-agents-hosting-core 0.6.0.dev4__tar.gz → 0.6.0.dev7__tar.gz
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.
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/PKG-INFO +2 -2
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/activity_handler.py +45 -24
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/agent_application.py +121 -100
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/typing_indicator.py +0 -1
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/channel_adapter.py +23 -16
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/channel_service_adapter.py +11 -4
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents_hosting_core.egg-info/PKG-INFO +2 -2
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents_hosting_core.egg-info/requires.txt +1 -1
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/LICENSE +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/_oauth/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/_oauth/_flow_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/_oauth/_flow_storage_client.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/_oauth/_oauth_flow.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/agent.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/_routes/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/_routes/_route.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/_routes/_route_list.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/_routes/route_rank.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/_type_defs.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/app_error.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/app_options.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/input_file.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/oauth/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/oauth/_handlers/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/oauth/_sign_in_response.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/oauth/_sign_in_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/oauth/auth_handler.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/oauth/authorization.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/query.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/state/conversation_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/state/state.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/state/temp_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/app/state/turn_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/authorization/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/authorization/access_token_provider_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/authorization/agent_auth_configuration.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/authorization/anonymous_token_provider.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/authorization/auth_types.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/authorization/authentication_constants.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/authorization/claims_identity.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/authorization/connections.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/authorization/jwt_token_validator.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/card_factory.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/channel_api_handler_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/channel_service_client_factory_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/agent_conversation_reference.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/channel_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/channel_host_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/channel_info_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/channel_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/channels_configuration.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/configuration_channel_host.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/conversation_constants.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/conversation_id_factory.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/conversation_id_factory_options.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/conversation_id_factory_protocol.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/http_agent_channel.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/client/http_agent_channel_factory.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/agent_sign_in_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/attachments_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/client/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/client/connector_client.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/client/user_token_client.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/connector_client_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/conversations_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/get_product_info.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/teams/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/teams/teams_connector_client.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/user_token_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/connector/user_token_client_base.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/message_factory.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/middleware_set.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/rest_channel_service_client_factory.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/state/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/state/agent_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/state/state_property_accessor.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/state/user_state.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/storage/__init__.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/storage/_type_aliases.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/storage/error_handling.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/storage/memory_storage.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/storage/storage.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/storage/store_item.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/storage/transcript_file_store.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/storage/transcript_info.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/storage/transcript_logger.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/storage/transcript_memory_store.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/storage/transcript_store.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents/hosting/core/turn_context.py +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents_hosting_core.egg-info/SOURCES.txt +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents_hosting_core.egg-info/dependency_links.txt +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/microsoft_agents_hosting_core.egg-info/top_level.txt +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/pyproject.toml +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/readme.md +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/setup.cfg +0 -0
- {microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/setup.py +0 -0
{microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-hosting-core
|
|
3
|
-
Version: 0.6.0.
|
|
3
|
+
Version: 0.6.0.dev7
|
|
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.6.0.
|
|
18
|
+
Requires-Dist: microsoft-agents-activity==0.6.0.dev7
|
|
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
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
from http import HTTPStatus
|
|
6
|
+
from typing import Awaitable
|
|
6
7
|
from pydantic import BaseModel
|
|
7
8
|
|
|
8
9
|
from microsoft_agents.activity import TurnContextProtocol
|
|
@@ -24,9 +25,9 @@ class ActivityHandler(Agent):
|
|
|
24
25
|
"""
|
|
25
26
|
Handles activities and should be subclassed.
|
|
26
27
|
|
|
27
|
-
..
|
|
28
|
+
.. note::
|
|
28
29
|
Derive from this class to handle particular activity types.
|
|
29
|
-
|
|
30
|
+
You can add pre and post processing of activities by calling the base class
|
|
30
31
|
in the derived class.
|
|
31
32
|
"""
|
|
32
33
|
|
|
@@ -34,15 +35,16 @@ class ActivityHandler(Agent):
|
|
|
34
35
|
self, turn_context: TurnContextProtocol
|
|
35
36
|
): # pylint: disable=arguments-differ
|
|
36
37
|
"""
|
|
37
|
-
Called by the adapter (for example, :class:`ChannelAdapter`) at runtime
|
|
38
|
+
Called by the adapter (for example, :class:`microsoft_agents.hosting.core.channel_adapter.ChannelAdapter`) at runtime
|
|
38
39
|
in order to process an inbound :class:`microsoft_agents.activity.Activity`.
|
|
39
40
|
|
|
40
41
|
:param turn_context: The context object for this turn
|
|
41
42
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
42
43
|
|
|
43
44
|
:returns: A task that represents the work queued to execute
|
|
45
|
+
:rtype: Awaitable[None]
|
|
44
46
|
|
|
45
|
-
..
|
|
47
|
+
.. note::
|
|
46
48
|
It calls other methods in this class based on the type of the activity to
|
|
47
49
|
process, which allows a derived class to provide type-specific logic in a controlled way.
|
|
48
50
|
In a derived class, override this method to add logic that applies to all activity types.
|
|
@@ -108,6 +110,7 @@ class ActivityHandler(Agent):
|
|
|
108
110
|
:param turn_context: The context object for this turn
|
|
109
111
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
110
112
|
:returns: A task that represents the work queued to execute
|
|
113
|
+
:rtype: Awaitable[None]
|
|
111
114
|
"""
|
|
112
115
|
return
|
|
113
116
|
|
|
@@ -121,6 +124,7 @@ class ActivityHandler(Agent):
|
|
|
121
124
|
:param turn_context: The context object for this turn
|
|
122
125
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
123
126
|
:returns: A task that represents the work queued to execute
|
|
127
|
+
:rtype: Awaitable[None]
|
|
124
128
|
"""
|
|
125
129
|
return
|
|
126
130
|
|
|
@@ -134,6 +138,7 @@ class ActivityHandler(Agent):
|
|
|
134
138
|
:param turn_context: The context object for this turn
|
|
135
139
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
136
140
|
:returns: A task that represents the work queued to execute
|
|
141
|
+
:rtype: Awaitable[None]
|
|
137
142
|
"""
|
|
138
143
|
return
|
|
139
144
|
|
|
@@ -145,17 +150,18 @@ class ActivityHandler(Agent):
|
|
|
145
150
|
:param turn_context: The context object for this turn
|
|
146
151
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
147
152
|
:returns: A task that represents the work queued to execute
|
|
153
|
+
:rtype: Awaitable[None]
|
|
148
154
|
|
|
149
|
-
..
|
|
155
|
+
.. note::
|
|
150
156
|
When the :meth:`on_turn()` method receives a conversation update activity, it calls this
|
|
151
157
|
method.
|
|
152
158
|
Also
|
|
153
159
|
- If the conversation update activity indicates that members other than the agent joined the conversation,
|
|
154
|
-
|
|
160
|
+
it calls the :meth:`on_members_added_activity()` method.
|
|
155
161
|
- If the conversation update activity indicates that members other than the agent left the conversation,
|
|
156
|
-
|
|
162
|
+
it calls the :meth:`on_members_removed_activity()` method.
|
|
157
163
|
- In a derived class, override this method to add logic that applies to all conversation update activities.
|
|
158
|
-
|
|
164
|
+
Add logic to apply before the member added or removed logic before the call to this base class method.
|
|
159
165
|
"""
|
|
160
166
|
# TODO: confirm behavior of added and removed at the same time as C# doesn't support it
|
|
161
167
|
if turn_context.activity.members_added:
|
|
@@ -175,13 +181,14 @@ class ActivityHandler(Agent):
|
|
|
175
181
|
the conversation. You can add your agent's welcome logic.
|
|
176
182
|
|
|
177
183
|
:param members_added: A list of all the members added to the conversation, as described by the
|
|
178
|
-
|
|
184
|
+
conversation update activity
|
|
179
185
|
:type members_added: list[:class:`microsoft_agents.activity.ChannelAccount`]
|
|
180
186
|
:param turn_context: The context object for this turn
|
|
181
187
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
182
188
|
:returns: A task that represents the work queued to execute
|
|
189
|
+
:rtype: Awaitable[None]
|
|
183
190
|
|
|
184
|
-
..
|
|
191
|
+
.. note::
|
|
185
192
|
When the :meth:`on_conversation_update_activity()` method receives a conversation
|
|
186
193
|
update activity that indicates
|
|
187
194
|
one or more users other than the agent are joining the conversation, it calls this method.
|
|
@@ -196,13 +203,14 @@ class ActivityHandler(Agent):
|
|
|
196
203
|
the conversation. You can add your agent's good-bye logic.
|
|
197
204
|
|
|
198
205
|
:param members_removed: A list of all the members removed from the conversation, as described by the
|
|
199
|
-
|
|
206
|
+
conversation update activity
|
|
200
207
|
:type members_removed: list[:class:`microsoft_agents.activity.ChannelAccount`]
|
|
201
208
|
:param turn_context: The context object for this turn
|
|
202
209
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
203
210
|
:returns: A task that represents the work queued to execute
|
|
211
|
+
:rtype: Awaitable[None]
|
|
204
212
|
|
|
205
|
-
..
|
|
213
|
+
.. note::
|
|
206
214
|
When the :meth:`on_conversation_update_activity()` method receives a conversation
|
|
207
215
|
update activity that indicates one or more users other than the agent are leaving the conversation,
|
|
208
216
|
it calls this method.
|
|
@@ -219,8 +227,9 @@ class ActivityHandler(Agent):
|
|
|
219
227
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
220
228
|
|
|
221
229
|
:returns: A task that represents the work queued to execute
|
|
230
|
+
:rtype: Awaitable[None]
|
|
222
231
|
|
|
223
|
-
..
|
|
232
|
+
.. note::
|
|
224
233
|
Message reactions correspond to the user adding a 'like' or 'sad' etc. (often an emoji) to a previously
|
|
225
234
|
sent activity.
|
|
226
235
|
|
|
@@ -231,9 +240,9 @@ class ActivityHandler(Agent):
|
|
|
231
240
|
method.
|
|
232
241
|
|
|
233
242
|
- If the message reaction indicates that reactions were added to a message, it calls
|
|
234
|
-
|
|
243
|
+
:meth:`on_reactions_added()`.
|
|
235
244
|
- If the message reaction indicates that reactions were removed from a message, it calls
|
|
236
|
-
|
|
245
|
+
:meth:`on_reactions_removed()`.
|
|
237
246
|
|
|
238
247
|
In a derived class, override this method to add logic that applies to all message reaction activities.
|
|
239
248
|
Add logic to apply before the reactions added or removed logic before the call to the this base class
|
|
@@ -264,8 +273,9 @@ class ActivityHandler(Agent):
|
|
|
264
273
|
:param turn_context: The context object for this turn
|
|
265
274
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
266
275
|
:returns: A task that represents the work queued to execute
|
|
276
|
+
:rtype: Awaitable[None]
|
|
267
277
|
|
|
268
|
-
..
|
|
278
|
+
.. note::
|
|
269
279
|
Message reactions correspond to the user adding a 'like' or 'sad' etc. (often an emoji)
|
|
270
280
|
to a previously sent message on the conversation.
|
|
271
281
|
Message reactions are supported by only a few channels.
|
|
@@ -290,8 +300,9 @@ class ActivityHandler(Agent):
|
|
|
290
300
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
291
301
|
|
|
292
302
|
:returns: A task that represents the work queued to execute
|
|
303
|
+
:rtype: Awaitable[None]
|
|
293
304
|
|
|
294
|
-
..
|
|
305
|
+
.. note::
|
|
295
306
|
Message reactions correspond to the user adding a 'like' or 'sad' etc. (often an emoji)
|
|
296
307
|
to a previously sent message on the conversation. Message reactions are supported by only a few channels.
|
|
297
308
|
The activity that the message is in reaction to is identified by the activity's reply to Id property.
|
|
@@ -308,8 +319,9 @@ class ActivityHandler(Agent):
|
|
|
308
319
|
:param turn_context: The context object for this turn
|
|
309
320
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
310
321
|
:returns: A task that represents the work queued to execute
|
|
322
|
+
:rtype: Awaitable[None]
|
|
311
323
|
|
|
312
|
-
..
|
|
324
|
+
.. note::
|
|
313
325
|
When the :meth:`on_turn()` method receives an event activity, it calls this method.
|
|
314
326
|
If the activity name is `tokens/response`, it calls :meth:`on_token_response_event()`;
|
|
315
327
|
otherwise, it calls :meth:`on_event()`.
|
|
@@ -338,8 +350,9 @@ class ActivityHandler(Agent):
|
|
|
338
350
|
:param turn_context: The context object for this turn
|
|
339
351
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
340
352
|
:returns: A task that represents the work queued to execute
|
|
353
|
+
:rtype: Awaitable[None]
|
|
341
354
|
|
|
342
|
-
..
|
|
355
|
+
.. note::
|
|
343
356
|
When the :meth:`on_event()` method receives an event with an activity name of
|
|
344
357
|
`tokens/response`, it calls this method. If your agent uses an `oauth_prompt`, forward the incoming
|
|
345
358
|
activity to the current dialog.
|
|
@@ -352,11 +365,13 @@ class ActivityHandler(Agent):
|
|
|
352
365
|
"""
|
|
353
366
|
Invoked when an event other than `tokens/response` is received when the base behavior of
|
|
354
367
|
:meth:`on_event_activity()` is used.
|
|
368
|
+
|
|
355
369
|
:param turn_context: The context object for this turn
|
|
356
370
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
357
371
|
:returns: A task that represents the work queued to execute
|
|
372
|
+
:rtype: Awaitable[None]
|
|
358
373
|
|
|
359
|
-
..
|
|
374
|
+
.. note::
|
|
360
375
|
When the :meth:`on_event_activity()` is used method receives an event with an
|
|
361
376
|
activity name other than `tokens/response`, it calls this method.
|
|
362
377
|
This method could optionally be overridden if the agent is meant to handle miscellaneous events.
|
|
@@ -368,9 +383,11 @@ class ActivityHandler(Agent):
|
|
|
368
383
|
):
|
|
369
384
|
"""
|
|
370
385
|
Invoked when a conversation end activity is received from the channel.
|
|
386
|
+
|
|
371
387
|
:param turn_context: The context object for this turn
|
|
372
388
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
373
389
|
:returns: A task that represents the work queued to execute
|
|
390
|
+
:rtype: Awaitable[None]
|
|
374
391
|
"""
|
|
375
392
|
return
|
|
376
393
|
|
|
@@ -384,6 +401,7 @@ class ActivityHandler(Agent):
|
|
|
384
401
|
:param turn_context: The context object for this turn
|
|
385
402
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
386
403
|
:returns: A task that represents the work queued to execute
|
|
404
|
+
:rtype: Awaitable[None]
|
|
387
405
|
"""
|
|
388
406
|
return
|
|
389
407
|
|
|
@@ -397,6 +415,7 @@ class ActivityHandler(Agent):
|
|
|
397
415
|
:param turn_context: The context object for this turn
|
|
398
416
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
399
417
|
:returns: A task that represents the work queued to execute
|
|
418
|
+
:rtype: Awaitable[None]
|
|
400
419
|
"""
|
|
401
420
|
if turn_context.activity.action in ("add", "add-upgrade"):
|
|
402
421
|
return await self.on_installation_update_add(turn_context)
|
|
@@ -414,6 +433,7 @@ class ActivityHandler(Agent):
|
|
|
414
433
|
:param turn_context: The context object for this turn
|
|
415
434
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
416
435
|
:returns: A task that represents the work queued to execute
|
|
436
|
+
:rtype: Awaitable[None]
|
|
417
437
|
"""
|
|
418
438
|
return
|
|
419
439
|
|
|
@@ -427,6 +447,7 @@ class ActivityHandler(Agent):
|
|
|
427
447
|
:param turn_context: The context object for this turn
|
|
428
448
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
429
449
|
:returns: A task that represents the work queued to execute
|
|
450
|
+
:rtype: Awaitable[None]
|
|
430
451
|
"""
|
|
431
452
|
return
|
|
432
453
|
|
|
@@ -440,10 +461,10 @@ class ActivityHandler(Agent):
|
|
|
440
461
|
|
|
441
462
|
:param turn_context: The context object for this turn
|
|
442
463
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
443
|
-
|
|
444
464
|
:returns: A task that represents the work queued to execute
|
|
465
|
+
:rtype: Awaitable[None]
|
|
445
466
|
|
|
446
|
-
..
|
|
467
|
+
.. note::
|
|
447
468
|
When the :meth:`on_turn()` method receives an activity that is not a message,
|
|
448
469
|
conversation update, message reaction, or event activity, it calls this method.
|
|
449
470
|
"""
|
|
@@ -494,8 +515,8 @@ class ActivityHandler(Agent):
|
|
|
494
515
|
|
|
495
516
|
:param turn_context: The context object for this turn
|
|
496
517
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
497
|
-
|
|
498
518
|
:returns: A task that represents the work queued to execute
|
|
519
|
+
:rtype: Awaitable[None]
|
|
499
520
|
"""
|
|
500
521
|
raise _InvokeResponseException(HTTPStatus.NOT_IMPLEMENTED)
|
|
501
522
|
|
|
@@ -512,7 +533,7 @@ class ActivityHandler(Agent):
|
|
|
512
533
|
:type turn_context: :class:`microsoft_agents.activity.TurnContextProtocol`
|
|
513
534
|
:param invoke_value: A string-typed object from the incoming activity's value.
|
|
514
535
|
:type invoke_value: :class:`microsoft_agents.activity.AdaptiveCardInvokeValue`
|
|
515
|
-
:
|
|
536
|
+
:returns: The HealthCheckResponse object
|
|
516
537
|
:rtype: :class:`microsoft_agents.activity.AdaptiveCardInvokeResponse`
|
|
517
538
|
"""
|
|
518
539
|
raise _InvokeResponseException(HTTPStatus.NOT_IMPLEMENTED)
|
|
@@ -236,7 +236,7 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
236
236
|
Routes are ordered by: is_agentic, is_invoke, rank (lower is higher priority), in that order.
|
|
237
237
|
|
|
238
238
|
:param selector: A function that takes a TurnContext and returns a boolean indicating whether the route should be selected.
|
|
239
|
-
:type selector: :class:`microsoft_agents.hosting.core.
|
|
239
|
+
:type selector: Callable[[:class:`microsoft_agents.hosting.core.turn_context.TurnContext`], bool]
|
|
240
240
|
:param handler: A function that takes a TurnContext and a TurnState and returns an Awaitable.
|
|
241
241
|
:type handler: :class:`microsoft_agents.hosting.core.app._type_defs.RouteHandler`[StateT]
|
|
242
242
|
:param is_invoke: Whether the route is for an invoke activity, defaults to False
|
|
@@ -245,7 +245,7 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
245
245
|
the selector will include a new check for `context.activity.is_agentic_request()`.
|
|
246
246
|
:type is_agentic: bool, Optional
|
|
247
247
|
:param rank: The rank of the route, defaults to RouteRank.DEFAULT
|
|
248
|
-
:type rank: :class:`microsoft_agents.hosting.core.app._routes.RouteRank`, Optional
|
|
248
|
+
:type rank: :class:`microsoft_agents.hosting.core.app._routes.route_rank.RouteRank`, Optional
|
|
249
249
|
:param auth_handlers: A list of authentication handler IDs to use for this route, defaults to None
|
|
250
250
|
:type auth_handlers: Optional[list[str]], Optional
|
|
251
251
|
:raises ApplicationError: If the selector or handler are not valid.
|
|
@@ -272,19 +272,21 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
272
272
|
**kwargs,
|
|
273
273
|
) -> Callable[[RouteHandler[StateT]], RouteHandler[StateT]]:
|
|
274
274
|
"""
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
275
|
+
Register a new activity event listener as either a decorator or a method.
|
|
276
|
+
|
|
277
|
+
Example:
|
|
278
|
+
.. code-block:: python
|
|
279
|
+
|
|
280
|
+
@app.activity("event")
|
|
281
|
+
async def on_event(context: TurnContext, state: TurnState):
|
|
282
|
+
print("hello world!")
|
|
283
|
+
return True
|
|
284
|
+
|
|
285
|
+
:param activity_type: Activity type or collection of types that should trigger the handler.
|
|
286
|
+
:type activity_type: Union[str, microsoft_agents.activity.ActivityTypes, list[Union[str, microsoft_agents.activity.ActivityTypes]]]
|
|
287
|
+
:param auth_handlers: Optional list of authorization handler IDs for the route.
|
|
288
|
+
:type auth_handlers: Optional[list[str]]
|
|
289
|
+
:param kwargs: Additional route configuration passed to :meth:`add_route`.
|
|
288
290
|
"""
|
|
289
291
|
|
|
290
292
|
def __selector(context: TurnContext):
|
|
@@ -307,18 +309,21 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
307
309
|
**kwargs,
|
|
308
310
|
) -> Callable[[RouteHandler[StateT]], RouteHandler[StateT]]:
|
|
309
311
|
"""
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
312
|
+
Register a new message activity event listener as either a decorator or a method.
|
|
313
|
+
|
|
314
|
+
Example:
|
|
315
|
+
.. code-block:: python
|
|
316
|
+
|
|
317
|
+
@app.message("hi")
|
|
318
|
+
async def on_hi_message(context: TurnContext, state: TurnState):
|
|
319
|
+
print("hello!")
|
|
320
|
+
return True
|
|
321
|
+
|
|
322
|
+
:param select: Literal text, compiled regex, or list of either used to match the incoming message.
|
|
323
|
+
:type select: Union[str, Pattern[str], list[Union[str, Pattern[str]]]]
|
|
324
|
+
:param auth_handlers: Optional list of authorization handler IDs for the route.
|
|
325
|
+
:type auth_handlers: Optional[list[str]]
|
|
326
|
+
:param kwargs: Additional route configuration passed to :meth:`add_route`.
|
|
322
327
|
"""
|
|
323
328
|
|
|
324
329
|
def __selector(context: TurnContext):
|
|
@@ -349,20 +354,21 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
349
354
|
**kwargs,
|
|
350
355
|
) -> Callable[[RouteHandler[StateT]], RouteHandler[StateT]]:
|
|
351
356
|
"""
|
|
352
|
-
|
|
353
|
-
a decorator or a method.
|
|
357
|
+
Register a handler for conversation update activities as either a decorator or a method.
|
|
354
358
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
@app.conversation_update("channelCreated")
|
|
358
|
-
async def on_channel_created(context: TurnContext, state: TurnState):
|
|
359
|
-
print("a new channel was created!")
|
|
360
|
-
return True
|
|
359
|
+
Example:
|
|
360
|
+
.. code-block:: python
|
|
361
361
|
|
|
362
|
-
|
|
362
|
+
@app.conversation_update("channelCreated")
|
|
363
|
+
async def on_channel_created(context: TurnContext, state: TurnState):
|
|
364
|
+
print("a new channel was created!")
|
|
365
|
+
return True
|
|
363
366
|
|
|
364
|
-
|
|
365
|
-
|
|
367
|
+
:param type: Conversation update category that must match the incoming activity.
|
|
368
|
+
:type type: microsoft_agents.activity.ConversationUpdateTypes
|
|
369
|
+
:param auth_handlers: Optional list of authorization handler IDs for the route.
|
|
370
|
+
:type auth_handlers: Optional[list[str]]
|
|
371
|
+
:param kwargs: Additional route configuration passed to :meth:`add_route`.
|
|
366
372
|
"""
|
|
367
373
|
|
|
368
374
|
def __selector(context: TurnContext):
|
|
@@ -402,19 +408,21 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
402
408
|
**kwargs,
|
|
403
409
|
) -> Callable[[RouteHandler[StateT]], RouteHandler[StateT]]:
|
|
404
410
|
"""
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
411
|
+
Register a handler for message reaction activities as either a decorator or a method.
|
|
412
|
+
|
|
413
|
+
Example:
|
|
414
|
+
.. code-block:: python
|
|
415
|
+
|
|
416
|
+
@app.message_reaction("reactionsAdded")
|
|
417
|
+
async def on_reactions_added(context: TurnContext, state: TurnState):
|
|
418
|
+
print("reaction was added!")
|
|
419
|
+
return True
|
|
420
|
+
|
|
421
|
+
:param type: Reaction category that must match the incoming activity.
|
|
422
|
+
:type type: microsoft_agents.activity.MessageReactionTypes
|
|
423
|
+
:param auth_handlers: Optional list of authorization handler IDs for the route.
|
|
424
|
+
:type auth_handlers: Optional[list[str]]
|
|
425
|
+
:param kwargs: Additional route configuration passed to :meth:`add_route`.
|
|
418
426
|
"""
|
|
419
427
|
|
|
420
428
|
def __selector(context: TurnContext):
|
|
@@ -450,19 +458,21 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
450
458
|
**kwargs,
|
|
451
459
|
) -> Callable[[RouteHandler[StateT]], RouteHandler[StateT]]:
|
|
452
460
|
"""
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
461
|
+
Register a handler for message update activities as either a decorator or a method.
|
|
462
|
+
|
|
463
|
+
Example:
|
|
464
|
+
.. code-block:: python
|
|
465
|
+
|
|
466
|
+
@app.message_update("editMessage")
|
|
467
|
+
async def on_edit_message(context: TurnContext, state: TurnState):
|
|
468
|
+
print("message was edited!")
|
|
469
|
+
return True
|
|
470
|
+
|
|
471
|
+
:param type: Message update category that must match the incoming activity.
|
|
472
|
+
:type type: microsoft_agents.activity.MessageUpdateTypes
|
|
473
|
+
:param auth_handlers: Optional list of authorization handler IDs for the route.
|
|
474
|
+
:type auth_handlers: Optional[list[str]]
|
|
475
|
+
:param kwargs: Additional route configuration passed to :meth:`add_route`.
|
|
466
476
|
"""
|
|
467
477
|
|
|
468
478
|
def __selector(context: TurnContext):
|
|
@@ -510,15 +520,18 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
510
520
|
Callable[[TurnContext, StateT, str], Awaitable[None]],
|
|
511
521
|
]:
|
|
512
522
|
"""
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
523
|
+
Register a handler to hand off conversations from one copilot to another.
|
|
524
|
+
|
|
525
|
+
Example:
|
|
526
|
+
.. code-block:: python
|
|
527
|
+
|
|
528
|
+
@app.handoff
|
|
529
|
+
async def on_handoff(context: TurnContext, state: TurnState, continuation: str):
|
|
530
|
+
print(continuation)
|
|
531
|
+
|
|
532
|
+
:param auth_handlers: Optional list of authorization handler IDs for the route.
|
|
533
|
+
:type auth_handlers: Optional[list[str]]
|
|
534
|
+
:param kwargs: Additional route configuration passed to :meth:`add_route`.
|
|
522
535
|
"""
|
|
523
536
|
|
|
524
537
|
def __selector(context: TurnContext) -> bool:
|
|
@@ -555,15 +568,18 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
555
568
|
self, func: Callable[[TurnContext, StateT, Optional[str]], Awaitable[None]]
|
|
556
569
|
) -> Callable[[TurnContext, StateT, Optional[str]], Awaitable[None]]:
|
|
557
570
|
"""
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
571
|
+
Register a callback that executes when a user successfully signs in.
|
|
572
|
+
|
|
573
|
+
Example:
|
|
574
|
+
.. code-block:: python
|
|
575
|
+
|
|
576
|
+
@app.on_sign_in_success
|
|
577
|
+
async def sign_in_success(context: TurnContext, state: TurnState, connection_id: str | None):
|
|
578
|
+
print("sign-in succeeded")
|
|
579
|
+
|
|
580
|
+
:param func: Callable that handles the sign-in success event.
|
|
581
|
+
:type func: Callable[[TurnContext, StateT, Optional[str]], Awaitable[None]]
|
|
582
|
+
:raises ApplicationError: If authorization services are not configured.
|
|
567
583
|
"""
|
|
568
584
|
|
|
569
585
|
if self._auth:
|
|
@@ -588,15 +604,18 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
588
604
|
self, func: Callable[[TurnContext, StateT, Optional[str]], Awaitable[None]]
|
|
589
605
|
) -> Callable[[TurnContext, StateT, Optional[str]], Awaitable[None]]:
|
|
590
606
|
"""
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
607
|
+
Register a callback that executes when a user fails to sign in.
|
|
608
|
+
|
|
609
|
+
Example:
|
|
610
|
+
.. code-block:: python
|
|
611
|
+
|
|
612
|
+
@app.on_sign_in_failure
|
|
613
|
+
async def sign_in_failure(context: TurnContext, state: TurnState, connection_id: str | None):
|
|
614
|
+
print("sign-in failed")
|
|
615
|
+
|
|
616
|
+
:param func: Callable that handles the sign-in failure event.
|
|
617
|
+
:type func: Callable[[TurnContext, StateT, Optional[str]], Awaitable[None]]
|
|
618
|
+
:raises ApplicationError: If authorization services are not configured.
|
|
600
619
|
"""
|
|
601
620
|
|
|
602
621
|
if self._auth:
|
|
@@ -621,15 +640,17 @@ class AgentApplication(Agent, Generic[StateT]):
|
|
|
621
640
|
self, func: Callable[[TurnContext, Exception], Awaitable[None]]
|
|
622
641
|
) -> Callable[[TurnContext, Exception], Awaitable[None]]:
|
|
623
642
|
"""
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
643
|
+
Register an error handler that is invoked whenever the application raises an exception.
|
|
644
|
+
|
|
645
|
+
Example:
|
|
646
|
+
.. code-block:: python
|
|
647
|
+
|
|
648
|
+
@app.error
|
|
649
|
+
async def on_error(context: TurnContext, err: Exception):
|
|
650
|
+
print(err)
|
|
651
|
+
|
|
652
|
+
:param func: Callable executed when an uncaught exception occurs during a turn.
|
|
653
|
+
:type func: Callable[[TurnContext, Exception], Awaitable[None]]
|
|
633
654
|
"""
|
|
634
655
|
|
|
635
656
|
logger.debug(f"Registering the error handler {func.__name__} ")
|
|
@@ -42,8 +42,9 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
42
42
|
:param context: The context object for the turn.
|
|
43
43
|
:type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
44
44
|
:param activities: The activities to send.
|
|
45
|
-
:type activities: list[Activity]
|
|
46
|
-
:return:
|
|
45
|
+
:type activities: list[microsoft_agents.activity.Activity]
|
|
46
|
+
:return: Channel responses produced by the adapter.
|
|
47
|
+
:rtype: list[microsoft_agents.activity.ResourceResponse]
|
|
47
48
|
"""
|
|
48
49
|
raise NotImplementedError()
|
|
49
50
|
|
|
@@ -56,7 +57,8 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
56
57
|
:type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
57
58
|
:param activity: New replacement activity.
|
|
58
59
|
:type activity: :class:`microsoft_agents.activity.Activity`
|
|
59
|
-
:return:
|
|
60
|
+
:return: None
|
|
61
|
+
:rtype: None
|
|
60
62
|
"""
|
|
61
63
|
raise NotImplementedError()
|
|
62
64
|
|
|
@@ -71,7 +73,8 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
71
73
|
:type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
72
74
|
:param reference: Conversation reference for the activity to delete.
|
|
73
75
|
:type reference: :class:`microsoft_agents.activity.ConversationReference`
|
|
74
|
-
:return:
|
|
76
|
+
:return: None
|
|
77
|
+
:rtype: None
|
|
75
78
|
"""
|
|
76
79
|
raise NotImplementedError()
|
|
77
80
|
|
|
@@ -80,7 +83,9 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
80
83
|
Registers a middleware handler with the adapter.
|
|
81
84
|
|
|
82
85
|
:param middleware: The middleware to register.
|
|
83
|
-
:
|
|
86
|
+
:type middleware: object
|
|
87
|
+
:return: The current adapter instance to support fluent calls.
|
|
88
|
+
:rtype: ChannelAdapter
|
|
84
89
|
"""
|
|
85
90
|
self.middleware_set.use(middleware)
|
|
86
91
|
return self
|
|
@@ -97,16 +102,14 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
97
102
|
to the user.
|
|
98
103
|
|
|
99
104
|
:param agent_id: The application ID of the agent. This parameter is ignored in
|
|
100
|
-
|
|
101
|
-
|
|
105
|
+
single-tenant adapters (Console, Test, etc.) but is required for multi-tenant adapters.
|
|
106
|
+
:type agent_id: str
|
|
102
107
|
:param reference: A reference to the conversation to continue.
|
|
103
108
|
:type reference: :class:`microsoft_agents.activity.ConversationReference`
|
|
104
109
|
:param callback: The method to call for the resulting agent turn.
|
|
105
110
|
:type callback: Callable[[microsoft_agents.hosting.core.turn_context.TurnContext], Awaitable]
|
|
106
|
-
:
|
|
107
|
-
:
|
|
108
|
-
:param audience:A value signifying the recipient of the proactive message.
|
|
109
|
-
:type audience: str
|
|
111
|
+
:return: Result produced by the adapter pipeline.
|
|
112
|
+
:rtype: typing.Any
|
|
110
113
|
"""
|
|
111
114
|
context = TurnContext(self, reference.get_continuation_activity())
|
|
112
115
|
return await self.run_pipeline(context, callback)
|
|
@@ -123,7 +126,7 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
123
126
|
Most channels require a user to initiate a conversation with an agent before the agent can send activities
|
|
124
127
|
to the user.
|
|
125
128
|
|
|
126
|
-
:param claims_identity: A :class:`microsoft_agents.hosting.core.ClaimsIdentity` for the conversation.
|
|
129
|
+
:param claims_identity: A :class:`microsoft_agents.hosting.core.authorization.ClaimsIdentity` for the conversation.
|
|
127
130
|
:type claims_identity: :class:`microsoft_agents.hosting.core.authorization.ClaimsIdentity`
|
|
128
131
|
:param continuation_activity: The activity to send.
|
|
129
132
|
:type continuation_activity: :class:`microsoft_agents.activity.Activity`
|
|
@@ -131,6 +134,8 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
131
134
|
:type callback: Callable[[microsoft_agents.hosting.core.turn_context.TurnContext], Awaitable]
|
|
132
135
|
:param audience: A value signifying the recipient of the proactive message.
|
|
133
136
|
:type audience: str
|
|
137
|
+
:return: Result produced by the adapter pipeline.
|
|
138
|
+
:rtype: typing.Any
|
|
134
139
|
"""
|
|
135
140
|
raise NotImplementedError()
|
|
136
141
|
|
|
@@ -154,16 +159,17 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
154
159
|
:type service_url: str
|
|
155
160
|
:param audience: A value signifying the recipient of the proactive message.
|
|
156
161
|
:type audience: str
|
|
157
|
-
:param conversation_parameters: The information to use to create the conversation
|
|
162
|
+
:param conversation_parameters: The information to use to create the conversation.
|
|
158
163
|
:type conversation_parameters: :class:`microsoft_agents.activity.ConversationParameters`
|
|
159
164
|
:param callback: The method to call for the resulting agent turn.
|
|
160
165
|
:type callback: Callable[[microsoft_agents.hosting.core.turn_context.TurnContext], Awaitable]
|
|
161
166
|
|
|
162
|
-
:raises
|
|
167
|
+
:raises Exception: Not implemented or when the implementation fails.
|
|
163
168
|
|
|
164
169
|
:return: A task representing the work queued to execute.
|
|
170
|
+
:rtype: typing.Any
|
|
165
171
|
|
|
166
|
-
..
|
|
172
|
+
.. note::
|
|
167
173
|
To start a conversation, your agent must know its account information and the user's
|
|
168
174
|
account information on that channel.
|
|
169
175
|
Most channels only support initiating a direct message (non-group) conversation.
|
|
@@ -225,7 +231,8 @@ class ChannelAdapter(ABC, ChannelAdapterProtocol):
|
|
|
225
231
|
:type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
226
232
|
:param callback: A callback method to run at the end of the pipeline.
|
|
227
233
|
:type callback: Callable[[TurnContext], Awaitable]
|
|
228
|
-
:return:
|
|
234
|
+
:return: Result produced by the middleware pipeline.
|
|
235
|
+
:rtype: typing.Any
|
|
229
236
|
"""
|
|
230
237
|
if context is None:
|
|
231
238
|
raise TypeError(context.__class__.__name__)
|
|
@@ -358,13 +358,13 @@ class ChannelServiceAdapter(ChannelAdapter, ABC):
|
|
|
358
358
|
:return: A task that represents the work queued to execute.
|
|
359
359
|
:rtype: Optional[:class:`microsoft_agents.activity.InvokeResponse`]
|
|
360
360
|
|
|
361
|
-
..
|
|
361
|
+
.. note::
|
|
362
362
|
This class processes an activity received by the agents web server. This includes any messages
|
|
363
363
|
sent from a user and is the method that drives what's often referred to as the
|
|
364
364
|
agent *reactive messaging* flow.
|
|
365
365
|
Call this method to reactively send a message to a conversation.
|
|
366
|
-
If the task completes successfully, then an :class:`InvokeResponse` is returned;
|
|
367
|
-
otherwise, `
|
|
366
|
+
If the task completes successfully, then an :class:`microsoft_agents.activity.InvokeResponse` is returned;
|
|
367
|
+
otherwise, `None` is returned.
|
|
368
368
|
"""
|
|
369
369
|
scopes: list[str] = None
|
|
370
370
|
outgoing_audience: str = None
|
|
@@ -493,7 +493,14 @@ class ChannelServiceAdapter(ChannelAdapter, ABC):
|
|
|
493
493
|
|
|
494
494
|
return context
|
|
495
495
|
|
|
496
|
-
def _process_turn_results(self, context: TurnContext) -> InvokeResponse:
|
|
496
|
+
def _process_turn_results(self, context: TurnContext) -> Optional[InvokeResponse]:
|
|
497
|
+
"""Process the results of a turn and return the appropriate response.
|
|
498
|
+
|
|
499
|
+
:param context: The turn context
|
|
500
|
+
:type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
|
|
501
|
+
:return: The invoke response, if applicable
|
|
502
|
+
:rtype: Optional[:class:`microsoft_agents.activity.InvokeResponse`]
|
|
503
|
+
"""
|
|
497
504
|
# Handle ExpectedReplies scenarios where all activities have been
|
|
498
505
|
# buffered and sent back at once in an invoke response.
|
|
499
506
|
if context.activity.delivery_mode == DeliveryModes.expect_replies:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: microsoft-agents-hosting-core
|
|
3
|
-
Version: 0.6.0.
|
|
3
|
+
Version: 0.6.0.dev7
|
|
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.6.0.
|
|
18
|
+
Requires-Dist: microsoft-agents-activity==0.6.0.dev7
|
|
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
|
{microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/pyproject.toml
RENAMED
|
File without changes
|
{microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/readme.md
RENAMED
|
File without changes
|
{microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/setup.cfg
RENAMED
|
File without changes
|
{microsoft_agents_hosting_core-0.6.0.dev4 → microsoft_agents_hosting_core-0.6.0.dev7}/setup.py
RENAMED
|
File without changes
|