4040class 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
0 commit comments