From 3cd4a556e69943cb17a6541a9d6ac31706ef6e45 Mon Sep 17 00:00:00 2001 From: Rodrigo Brandao Date: Tue, 7 Jul 2026 08:38:12 -0700 Subject: [PATCH 1/4] Removing logger from ApplicationOptions --- .../hosting/core/app/agent_application.py | 42 ++++++++++++------- .../hosting/core/app/app_options.py | 12 ------ 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py index 2ce8e082..77fbae60 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py @@ -127,9 +127,11 @@ def __init__( "ApplicationOptions.storage is required and was not configured.", stack_info=True, ) - raise ApplicationError(""" + raise ApplicationError( + """ The `ApplicationOptions.storage` property is required and was not configured. - """) + """ + ) if options.long_running_messages and ( not options.adapter or not options.bot_app_id @@ -138,10 +140,12 @@ def __init__( "ApplicationOptions.long_running_messages requires an adapter and bot_app_id.", stack_info=True, ) - raise ApplicationError(""" + raise ApplicationError( + """ The `ApplicationOptions.long_running_messages` property is unavailable because no adapter or `bot_app_id` was configured. - """) + """ + ) if options.adapter: self._adapter = options.adapter @@ -217,10 +221,12 @@ def adapter(self) -> ChannelServiceAdapter: "AgentApplication.adapter(): self._adapter is not configured.", stack_info=True, ) - raise ApplicationError(""" + raise ApplicationError( + """ The AgentApplication.adapter property is unavailable because it was not configured when creating the AgentApplication. - """) + """ + ) return self._adapter @@ -238,10 +244,12 @@ def auth(self) -> Authorization: "AgentApplication.auth(): self._auth is not configured.", stack_info=True, ) - raise ApplicationError(""" + raise ApplicationError( + """ The `AgentApplication.auth` property is unavailable because no Auth options were configured. - """) + """ + ) return self._auth @@ -269,10 +277,12 @@ def proactive(self) -> Proactive: "AgentApplication.proactive(): proactive options are not configured.", stack_info=True, ) - raise ApplicationError(""" + raise ApplicationError( + """ The `AgentApplication.proactive` property is unavailable because no ProactiveOptions were configured in ApplicationOptions. - """) + """ + ) return self._proactive def before_turn( @@ -724,10 +734,12 @@ async def sign_in_success(context: TurnContext, state: TurnState, connection_id: f"Failed to register sign-in success handler for route handler {func.__name__}", stack_info=True, ) - raise ApplicationError(""" + raise ApplicationError( + """ The `AgentApplication.on_sign_in_success` method is unavailable because no Auth options were configured. - """) + """ + ) return func def on_sign_in_failure( @@ -758,10 +770,12 @@ async def sign_in_failure(context: TurnContext, state: TurnState, connection_id: f"Failed to register sign-in failure handler for route handler {func.__name__}", stack_info=True, ) - raise ApplicationError(""" + raise ApplicationError( + """ The `AgentApplication.on_sign_in_failure` method is unavailable because no Auth options were configured. - """) + """ + ) return func def error( diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/app_options.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/app_options.py index 27a2013f..744a8647 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/app_options.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/app_options.py @@ -20,8 +20,6 @@ from .state.turn_state import TurnState from .proactive.proactive_options import ProactiveOptions -# from .teams_adapter import TeamsAdapter - @dataclass class ApplicationOptions: @@ -30,11 +28,6 @@ class ApplicationOptions: Optional. Options used to initialize your `BotAdapter` """ - # auth: Optional[AuthOptions] = None - """ - Optional. Auth settings. - """ - bot_app_id: str = "" """ Optional. `AgentApplication` ID of the bot. @@ -45,11 +38,6 @@ class ApplicationOptions: Optional. `Storage` provider to use for the application. """ - logger: Logger = Logger(__name__) - """ - Optional. `Logger` that will be used in this application. - """ - remove_recipient_mention: bool = True """ Optional. If true, the bot will automatically remove mentions of the bot's name from incoming From 493481cc929567d0081b0628214f3bb78d8b0456 Mon Sep 17 00:00:00 2001 From: Rodrigo Brandao Date: Tue, 7 Jul 2026 08:41:31 -0700 Subject: [PATCH 2/4] Another commit --- .../hosting/core/app/agent_application.py | 49 +++++++------------ 1 file changed, 17 insertions(+), 32 deletions(-) diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py index 77fbae60..48023e62 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py @@ -47,6 +47,8 @@ from ._routes import _RouteList, _Route, RouteRank, _agentic_selector from .proactive import Proactive, ProactiveOptions +from ._utils import _log_app_config + logger = logging.getLogger(__name__) StateT = TypeVar("StateT", bound=TurnState) @@ -104,10 +106,7 @@ def __init__( configuration = kwargs - logger.debug(f"Initializing AgentApplication with options: {options}") - logger.debug( - f"Initializing AgentApplication with configuration: {configuration}" - ) + _log_app_config(logger, options, **kwargs) if not options: # TODO: consolidate configuration story @@ -127,11 +126,9 @@ def __init__( "ApplicationOptions.storage is required and was not configured.", stack_info=True, ) - raise ApplicationError( - """ + raise ApplicationError(""" The `ApplicationOptions.storage` property is required and was not configured. - """ - ) + """) if options.long_running_messages and ( not options.adapter or not options.bot_app_id @@ -140,12 +137,10 @@ def __init__( "ApplicationOptions.long_running_messages requires an adapter and bot_app_id.", stack_info=True, ) - raise ApplicationError( - """ + raise ApplicationError(""" The `ApplicationOptions.long_running_messages` property is unavailable because no adapter or `bot_app_id` was configured. - """ - ) + """) if options.adapter: self._adapter = options.adapter @@ -221,12 +216,10 @@ def adapter(self) -> ChannelServiceAdapter: "AgentApplication.adapter(): self._adapter is not configured.", stack_info=True, ) - raise ApplicationError( - """ + raise ApplicationError(""" The AgentApplication.adapter property is unavailable because it was not configured when creating the AgentApplication. - """ - ) + """) return self._adapter @@ -244,12 +237,10 @@ def auth(self) -> Authorization: "AgentApplication.auth(): self._auth is not configured.", stack_info=True, ) - raise ApplicationError( - """ + raise ApplicationError(""" The `AgentApplication.auth` property is unavailable because no Auth options were configured. - """ - ) + """) return self._auth @@ -277,12 +268,10 @@ def proactive(self) -> Proactive: "AgentApplication.proactive(): proactive options are not configured.", stack_info=True, ) - raise ApplicationError( - """ + raise ApplicationError(""" The `AgentApplication.proactive` property is unavailable because no ProactiveOptions were configured in ApplicationOptions. - """ - ) + """) return self._proactive def before_turn( @@ -734,12 +723,10 @@ async def sign_in_success(context: TurnContext, state: TurnState, connection_id: f"Failed to register sign-in success handler for route handler {func.__name__}", stack_info=True, ) - raise ApplicationError( - """ + raise ApplicationError(""" The `AgentApplication.on_sign_in_success` method is unavailable because no Auth options were configured. - """ - ) + """) return func def on_sign_in_failure( @@ -770,12 +757,10 @@ async def sign_in_failure(context: TurnContext, state: TurnState, connection_id: f"Failed to register sign-in failure handler for route handler {func.__name__}", stack_info=True, ) - raise ApplicationError( - """ + raise ApplicationError(""" The `AgentApplication.on_sign_in_failure` method is unavailable because no Auth options were configured. - """ - ) + """) return func def error( From e03696ae2ea22c995e78d8bd9bd0cad0acb3efc5 Mon Sep 17 00:00:00 2001 From: Rodrigo Brandao Date: Tue, 7 Jul 2026 08:44:24 -0700 Subject: [PATCH 3/4] Another commit --- .../microsoft_agents/hosting/core/app/agent_application.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py index 48023e62..2a1f6b84 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/agent_application.py @@ -47,8 +47,6 @@ from ._routes import _RouteList, _Route, RouteRank, _agentic_selector from .proactive import Proactive, ProactiveOptions -from ._utils import _log_app_config - logger = logging.getLogger(__name__) StateT = TypeVar("StateT", bound=TurnState) @@ -106,8 +104,6 @@ def __init__( configuration = kwargs - _log_app_config(logger, options, **kwargs) - if not options: # TODO: consolidate configuration story # Take the options from the kwargs and create an ApplicationOptions instance From cb45bb225473f79904dc3c9a82f09ec32ceac090 Mon Sep 17 00:00:00 2001 From: Rodrigo Brandao Date: Tue, 7 Jul 2026 08:49:19 -0700 Subject: [PATCH 4/4] Removed unused import --- .../microsoft_agents/hosting/core/app/app_options.py | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/app_options.py b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/app_options.py index 744a8647..20060e40 100644 --- a/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/app_options.py +++ b/libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/app_options.py @@ -6,7 +6,6 @@ from __future__ import annotations from dataclasses import dataclass, field -from logging import Logger from typing import Callable, Optional from microsoft_agents.hosting.core.app.oauth import AuthHandler