Skip to content

Commit 71bb4f8

Browse files
authored
Renaming bot references (#16)
* WIP - Renaming bot references * WIP - Renaming bot references * WIP - Renaming bot references * Renaming bot references. Samples tested * Renaming bot references. Formatting
1 parent 99314d2 commit 71bb4f8

78 files changed

Lines changed: 418 additions & 461 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.azdo/ci-pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ steps:
5252
python -m pip install ./dist/microsoft_agents_authentication*.whl
5353
python -m pip install ./dist/microsoft_agents_connector*.whl
5454
python -m pip install ./dist/microsoft_agents_client*.whl
55-
python -m pip install ./dist/microsoft_agents_botbuilder*.whl
55+
python -m pip install ./dist/microsoft_agents_builder*.whl
5656
python -m pip install ./dist/microsoft_agents_authorization_msal*.whl
5757
python -m pip install ./dist/microsoft_agents_copilotstudio_client*.whl
5858
python -m pip install ./dist/microsoft_agents_hosting_aiohttp*.whl

.github/workflows/python-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
python -m pip install ./dist/microsoft_agents_authentication*.whl
5656
python -m pip install ./dist/microsoft_agents_connector*.whl
5757
python -m pip install ./dist/microsoft_agents_client*.whl
58-
python -m pip install ./dist/microsoft_agents_botbuilder*.whl
58+
python -m pip install ./dist/microsoft_agents_builder*.whl
5959
python -m pip install ./dist/microsoft_agents_authorization_msal*.whl
6060
python -m pip install ./dist/microsoft_agents_copilotstudio_client*.whl
6161
python -m pip install ./dist/microsoft_agents_hosting_aiohttp*.whl

libraries/Authentication/microsoft-agents-authorization-msal/microsoft/agents/authorization/msal/msal_auth_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
from typing import Protocol, Optional
22

3-
from microsoft.agents.authentication import BotAuthConfiguration
3+
from microsoft.agents.authentication import AgentAuthConfiguration
44

55
from .auth_types import AuthTypes
66

77

8-
class MsalAuthConfiguration(BotAuthConfiguration, Protocol):
8+
class MsalAuthConfiguration(AgentAuthConfiguration, Protocol):
99
"""
1010
Configuration for MSAL authentication.
1111
"""

libraries/Botbuilder/microsoft-agents-botbuilder/microsoft/agents/botbuilder/__init__.py renamed to libraries/Builder/microsoft-agents-builder/microsoft/agents/builder/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Import necessary modules
22
from .activity_handler import ActivityHandler
3-
from .bot import Bot
3+
from .agent import Agent
44
from .channel_adapter import ChannelAdapter
55
from .channel_api_handler_protocol import ChannelApiHandlerProtocol
66
from .channel_service_adapter import ChannelServiceAdapter
@@ -13,7 +13,7 @@
1313
# Define the package's public interface
1414
__all__ = [
1515
"ActivityHandler",
16-
"Bot",
16+
"Agent",
1717
"ChannelAdapter",
1818
"ChannelApiHandlerProtocol",
1919
"ChannelServiceAdapter",

libraries/Botbuilder/microsoft-agents-botbuilder/microsoft/agents/botbuilder/activity_handler.py renamed to libraries/Builder/microsoft-agents-builder/microsoft/agents/builder/activity_handler.py

Lines changed: 42 additions & 42 deletions
Large diffs are not rendered by default.

libraries/Botbuilder/microsoft-agents-botbuilder/microsoft/agents/botbuilder/bot.py renamed to libraries/Builder/microsoft-agents-builder/microsoft/agents/builder/agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
from .turn_context import TurnContext
88

99

10-
class Bot(Protocol):
10+
class Agent(Protocol):
1111
"""
12-
Represents a bot that can operate on incoming activities.
12+
Represents an agent that can operate on incoming activities.
1313
"""
1414

1515
@abstractmethod
1616
async def on_turn(self, context: TurnContext):
1717
"""
18-
When implemented in a bot, handles an incoming activity.
18+
When implemented in an agent, handles an incoming activity.
1919
:param context: The context object for this turn.
2020
:return:
2121
"""

libraries/Botbuilder/microsoft-agents-botbuilder/microsoft/agents/botbuilder/channel_adapter.py renamed to libraries/Builder/microsoft-agents-builder/microsoft/agents/builder/channel_adapter.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919

2020
class ChannelAdapter(ABC, ChannelAdapterProtocol):
21-
BOT_IDENTITY_KEY = "BotIdentity"
22-
OAUTH_SCOPE_KEY = "Microsoft.Agents.BotBuilder.ChannelAdapter.OAuthScope"
21+
AGENT_IDENTITY_KEY = "AgentIdentity"
22+
OAUTH_SCOPE_KEY = "Microsoft.Agents.Builder.ChannelAdapter.OAuthScope"
2323
INVOKE_RESPONSE_KEY = "ChannelAdapter.InvokeResponse"
2424

2525
on_turn_error: Callable[[TurnContext, Exception], Awaitable] = None
@@ -50,7 +50,7 @@ async def update_activity(self, context: TurnContext, activity: Activity):
5050
:param context: The context object for the turn.
5151
:type context: :class:`TurnContext`
5252
:param activity: New replacement activity.
53-
:type activity: :class:`botbuilder.schema.Activity`
53+
:type activity: :class:`builder.schema.Activity`
5454
:return:
5555
"""
5656
raise NotImplementedError()
@@ -65,7 +65,7 @@ async def delete_activity(
6565
:param context: The context object for the turn.
6666
:type context: :class:`TurnContext`
6767
:param reference: Conversation reference for the activity to delete.
68-
:type reference: :class:`botbuilder.schema.ConversationReference`
68+
:type reference: :class:`builder.schema.ConversationReference`
6969
:return:
7070
"""
7171
raise NotImplementedError()
@@ -82,24 +82,24 @@ def use(self, middleware):
8282

8383
async def continue_conversation(
8484
self,
85-
bot_id: str, # pylint: disable=unused-argument
85+
agent_id: str, # pylint: disable=unused-argument
8686
reference: ConversationReference,
8787
callback: Callable[[TurnContext], Awaitable],
8888
):
8989
"""
9090
Sends a proactive message to a conversation. Call this method to proactively send a message to a conversation.
91-
Most channels require a user to initiate a conversation with a bot before the bot can send activities
91+
Most channels require a user to initiate a conversation with an agent before the agent can send activities
9292
to the user.
9393
94-
:param bot_id: The application ID of the bot. This parameter is ignored in
95-
single tenant the Adapters (Console, Test, etc) but is critical to the BotFrameworkAdapter
94+
:param agent_id: The application ID of the agent. This parameter is ignored in
95+
single tenant the Adapters (Console, Test, etc) but is critical to the ChannelAdapter
9696
which is multi-tenant aware.
9797
:param reference: A reference to the conversation to continue.
98-
:type reference: :class:`botbuilder.schema.ConversationReference`
99-
:param callback: The method to call for the resulting bot turn.
98+
:type reference: :class:`builder.schema.ConversationReference`
99+
:param callback: The method to call for the resulting agent turn.
100100
:type callback: :class:`typing.Callable`
101-
:param claims_identity: A :class:`botframework.connector.auth.ClaimsIdentity` for the conversation.
102-
:type claims_identity: :class:`botframework.connector.auth.ClaimsIdentity`
101+
:param claims_identity: A :class:`microsoft.agents.authentication.ClaimsIdentity` for the conversation.
102+
:type claims_identity: :class:`microsoft.agents.authentication.ClaimsIdentity`
103103
:param audience:A value signifying the recipient of the proactive message.
104104
:type audience: str
105105
"""
@@ -115,14 +115,14 @@ async def continue_conversation_with_claims(
115115
):
116116
"""
117117
Sends a proactive message to a conversation. Call this method to proactively send a message to a conversation.
118-
Most channels require a user to initiate a conversation with a bot before the bot can send activities
118+
Most channels require a user to initiate a conversation with an agent before the agent can send activities
119119
to the user.
120120
121-
:param claims_identity: A :class:`botframework.connector.auth.ClaimsIdentity` for the conversation.
122-
:type claims_identity: :class:`botframework.connector.auth.ClaimsIdentity`
121+
:param claims_identity: A :class:`microsoft.agents.authentication.ClaimsIdentity` for the conversation.
122+
:type claims_identity: :class:`microsoft.agents.authentication.ClaimsIdentity`
123123
:param continuation_activity: The activity to send.
124-
:type continuation_activity: :class:`botbuilder
125-
:param callback: The method to call for the resulting bot turn.
124+
:type continuation_activity: :class:`builder
125+
:param callback: The method to call for the resulting agent turn.
126126
:type callback: :class:`typing.Callable`
127127
:param audience: A value signifying the recipient of the proactive message.
128128
:type audience: str
@@ -131,7 +131,7 @@ async def continue_conversation_with_claims(
131131

132132
async def create_conversation(
133133
self,
134-
bot_app_id: str,
134+
agent_app_id: str,
135135
channel_id: str,
136136
service_url: str,
137137
audience: str,
@@ -142,7 +142,7 @@ async def create_conversation(
142142
Starts a new conversation with a user. Used to direct message to a member of a group.
143143
144144
:param reference: The conversation reference that contains the tenant
145-
:type reference: :class:`botbuilder.schema.ConversationReference`
145+
:type reference: :class:`builder.schema.ConversationReference`
146146
:param logic: The logic to use for the creation of the conversation
147147
:type logic: :class:`typing.Callable`
148148
:param conversation_parameters: The information to use to create the conversation
@@ -151,15 +151,15 @@ async def create_conversation(
151151
:type channel_id: :class:`typing.str`
152152
:param service_url: The channel's service URL endpoint.
153153
:type service_url: :class:`typing.str`
154-
:param credentials: The application credentials for the bot.
155-
:type credentials: :class:`botframework.connector.auth.AppCredentials`
154+
:param credentials: The application credentials for the agent.
155+
:type credentials: :class:`microsoft.agents.authentication.AppCredentials`
156156
157157
:raises: It raises a generic exception error.
158158
159159
:return: A task representing the work queued to execute.
160160
161161
.. remarks::
162-
To start a conversation, your bot must know its account information and the user's
162+
To start a conversation, your agent must know its account information and the user's
163163
account information on that channel.
164164
Most channels only support initiating a direct message (non-group) conversation.
165165
The adapter attempts to create a new conversation on the channel, and

libraries/Botbuilder/microsoft-agents-botbuilder/microsoft/agents/botbuilder/channel_api_handler_protocol.py renamed to libraries/Builder/microsoft-agents-builder/microsoft/agents/builder/channel_api_handler_protocol.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async def on_get_conversations(
2525
continuation_token: Optional[str] = None,
2626
) -> ConversationsResult:
2727
"""
28-
List the Conversations in which this bot has participated.
28+
List the Conversations in which this agent has participated.
2929
"""
3030
raise NotImplementedError()
3131

libraries/Botbuilder/microsoft-agents-botbuilder/microsoft/agents/botbuilder/channel_service_adapter.py renamed to libraries/Builder/microsoft-agents-builder/microsoft/agents/builder/channel_service_adapter.py

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
class ChannelServiceAdapter(ChannelAdapter, ABC):
4141
CONNECTOR_FACTORY_KEY = "ConnectorFactory"
4242
USER_TOKEN_CLIENT_KEY = "UserTokenClient"
43-
BOT_CALLBACK_HANDLER_KEY = "BotCallbackHandler"
43+
AGENT_CALLBACK_HANDLER_KEY = "AgentCallbackHandler"
4444
CHANNEL_SERVICE_FACTORY_KEY = "ChannelServiceClientFactory"
45-
_BOT_CONNECTOR_CLIENT_KEY = "ConnectorClient"
46-
_INVOKE_RESPONSE_KEY = "BotFrameworkAdapter.InvokeResponse"
45+
_AGENT_CONNECTOR_CLIENT_KEY = "ConnectorClient"
46+
_INVOKE_RESPONSE_KEY = "ChannelServiceAdapter.InvokeResponse"
4747

4848
def __init__(self, channel_service_client_factory: ChannelServiceClientFactoryBase):
4949
super().__init__()
@@ -82,7 +82,7 @@ async def send_activities(
8282
else:
8383
connector_client = cast(
8484
ConnectorClientBase,
85-
context.turn_state.get(self._BOT_CONNECTOR_CLIENT_KEY),
85+
context.turn_state.get(self._AGENT_CONNECTOR_CLIENT_KEY),
8686
)
8787
if not connector_client:
8888
raise Error("Unable to extract ConnectorClient from turn context.")
@@ -117,7 +117,8 @@ async def update_activity(self, context: TurnContext, activity: Activity):
117117
raise TypeError("Expected Activity but got None instead")
118118

119119
connector_client = cast(
120-
ConnectorClientBase, context.turn_state.get(self._BOT_CONNECTOR_CLIENT_KEY)
120+
ConnectorClientBase,
121+
context.turn_state.get(self._AGENT_CONNECTOR_CLIENT_KEY),
121122
)
122123
if not connector_client:
123124
raise Error("Unable to extract ConnectorClient from turn context.")
@@ -136,7 +137,8 @@ async def delete_activity(
136137
raise TypeError("Expected ConversationReference but got None instead")
137138

138139
connector_client = cast(
139-
ConnectorClientBase, context.turn_state.get(self._BOT_CONNECTOR_CLIENT_KEY)
140+
ConnectorClientBase,
141+
context.turn_state.get(self._AGENT_CONNECTOR_CLIENT_KEY),
140142
)
141143
if not connector_client:
142144
raise Error("Unable to extract ConnectorClient from turn context.")
@@ -147,23 +149,23 @@ async def delete_activity(
147149

148150
async def continue_conversation( # pylint: disable=arguments-differ
149151
self,
150-
bot_app_id: str,
152+
agent_app_id: str,
151153
continuation_activity: Activity,
152154
callback: Callable[[TurnContext], Awaitable],
153155
):
154156
"""
155157
Sends a proactive message to a conversation.
156158
Call this method to proactively send a message to a conversation.
157-
Most channels require a user to initiate a conversation with a bot before the bot can send activities
159+
Most channels require a user to initiate a conversation with an agent before the agent can send activities
158160
to the user.
159161
160162
:param reference: A reference to the conversation to continue.
161-
:type reference: :class:`botbuilder.schema.ConversationReference`
162-
:param callback: The method to call for the resulting bot turn.
163+
:type reference: :class:`builder.schema.ConversationReference`
164+
:param callback: The method to call for the resulting agent turn.
163165
:type callback: :class:`typing.Callable`
164-
:param bot_app_id: The application Id of the bot. This is the appId returned by the Azure portal registration,
166+
:param agent_app_id: The application Id of the agent. This is the appId returned by the Azure portal registration,
165167
and is generally found in the `MicrosoftAppId` parameter in `config.py`.
166-
:type bot_app_id: :class:`typing.str`
168+
:type agent_app_id: :class:`typing.str`
167169
"""
168170
if not callable:
169171
raise TypeError(
@@ -172,7 +174,7 @@ async def continue_conversation( # pylint: disable=arguments-differ
172174

173175
self._validate_continuation_activity(continuation_activity)
174176

175-
claims_identity = self.create_claims_identity(bot_app_id)
177+
claims_identity = self.create_claims_identity(agent_app_id)
176178

177179
return await self.process_proactive(
178180
claims_identity,
@@ -194,7 +196,7 @@ async def continue_conversation_with_claims(
194196

195197
async def create_conversation( # pylint: disable=arguments-differ
196198
self,
197-
bot_app_id: str,
199+
agent_app_id: str,
198200
channel_id: str,
199201
service_url: str,
200202
audience: str,
@@ -213,7 +215,7 @@ async def create_conversation( # pylint: disable=arguments-differ
213215
raise TypeError("CloudAdapter.create_conversation(): callback is required.")
214216

215217
# Create a ClaimsIdentity, to create the connector and for adding to the turn context.
216-
claims_identity = self.create_claims_identity(bot_app_id)
218+
claims_identity = self.create_claims_identity(agent_app_id)
217219
claims_identity.claims[AuthenticationConstants.SERVICE_URL_CLAIM] = service_url
218220

219221
# Create the connector client to use for outbound requests.
@@ -314,23 +316,23 @@ async def process_activity(
314316
:return: A task that represents the work queued to execute.
315317
316318
.. remarks::
317-
This class processes an activity received by the bots web server. This includes any messages
319+
This class processes an activity received by the agents web server. This includes any messages
318320
sent from a user and is the method that drives what's often referred to as the
319-
bots *reactive messaging* flow.
321+
agent *reactive messaging* flow.
320322
Call this method to reactively send a message to a conversation.
321323
If the task completes successfully, then an :class:`InvokeResponse` is returned;
322324
otherwise. `null` is returned.
323325
"""
324326
scopes: list[str] = None
325327
outgoing_audience: str = None
326328

327-
if claims_identity.is_bot_claim():
329+
if claims_identity.is_agent_claim():
328330
outgoing_audience = claims_identity.get_token_audience()
329331
scopes = [f"{claims_identity.get_outgoing_app_id()}/.default"]
330-
activity.caller_id = f"{CallerIdConstants.bot_to_bot_prefix}{claims_identity.get_outgoing_app_id()}"
332+
activity.caller_id = f"{CallerIdConstants.agent_to_agent_prefix}{claims_identity.get_outgoing_app_id()}"
331333
else:
332-
outgoing_audience = AuthenticationConstants.BOT_FRAMEWORK_SCOPE
333-
scopes = [f"{AuthenticationConstants.BOT_FRAMEWORK_SCOPE}/.default"]
334+
outgoing_audience = AuthenticationConstants.AGENTS_SDK_SCOPE
335+
scopes = [f"{AuthenticationConstants.AGENTS_SDK_SCOPE}/.default"]
334336

335337
use_anonymous_auth_callback = False
336338
if (
@@ -375,11 +377,11 @@ async def process_activity(
375377
# If there are any results they will have been left on the TurnContext.
376378
return self._process_turn_results(context)
377379

378-
def create_claims_identity(self, bot_app_id: str = "") -> ClaimsIdentity:
380+
def create_claims_identity(self, agent_app_id: str = "") -> ClaimsIdentity:
379381
return ClaimsIdentity(
380382
{
381-
AuthenticationConstants.AUDIENCE_CLAIM: bot_app_id,
382-
AuthenticationConstants.APP_ID_CLAIM: bot_app_id,
383+
AuthenticationConstants.AUDIENCE_CLAIM: agent_app_id,
384+
AuthenticationConstants.APP_ID_CLAIM: agent_app_id,
383385
},
384386
False,
385387
)
@@ -417,7 +419,7 @@ def _create_create_activity(
417419
tenant_id=conversation_parameters.tenant_id,
418420
)
419421
activity.channel_data = conversation_parameters.channel_data
420-
activity.recipient = conversation_parameters.bot
422+
activity.recipient = conversation_parameters.agent
421423

422424
return activity
423425

@@ -432,10 +434,10 @@ def _create_turn_context(
432434
) -> TurnContext:
433435
context = TurnContext(self, activity)
434436

435-
context.turn_state[self.BOT_IDENTITY_KEY] = claims_identity
436-
context.turn_state[self._BOT_CONNECTOR_CLIENT_KEY] = connector_client
437+
context.turn_state[self.AGENT_IDENTITY_KEY] = claims_identity
438+
context.turn_state[self._AGENT_CONNECTOR_CLIENT_KEY] = connector_client
437439
context.turn_state[self.USER_TOKEN_CLIENT_KEY] = user_token_client
438-
context.turn_state[self.BOT_CALLBACK_HANDLER_KEY] = callback
440+
context.turn_state[self.AGENT_CALLBACK_HANDLER_KEY] = callback
439441
context.turn_state[self.CHANNEL_SERVICE_FACTORY_KEY] = (
440442
self._channel_service_client_factory
441443
)
@@ -454,7 +456,7 @@ def _process_turn_results(self, context: TurnContext) -> InvokeResponse:
454456
).model_dump(mode="json", by_alias=True, exclude_unset=True),
455457
)
456458

457-
# Handle Invoke scenarios where the bot will return a specific body and return code.
459+
# Handle Invoke scenarios where the agent will return a specific body and return code.
458460
if context.activity.type == ActivityTypes.invoke:
459461
activity_invoke_response: Activity = context.turn_state.get(
460462
self._INVOKE_RESPONSE_KEY

libraries/Botbuilder/microsoft-agents-botbuilder/microsoft/agents/botbuilder/channel_service_client_factory_base.py renamed to libraries/Builder/microsoft-agents-builder/microsoft/agents/builder/channel_service_client_factory_base.py

File renamed without changes.

0 commit comments

Comments
 (0)