From e0846b252a423e52eaf96183a0adfa76fb258208 Mon Sep 17 00:00:00 2001 From: edle Date: Wed, 18 Mar 2026 12:36:48 -0400 Subject: [PATCH 1/4] Changes --- .../notifications/agent_notification.py | 69 +++++++++++++++++++ .../models/agent_lifecycle_event.py | 5 +- 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py index a604670c..869490a6 100644 --- a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py +++ b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py @@ -426,6 +426,75 @@ async def handle_user_deleted(context, state, notification): """ return self.on_lifecycle_notification(AgentLifecycleEvent.USERDELETED, **kwargs) + def on_user_undeleted( + self, **kwargs: Any + ) -> Callable[[AgentHandler], Callable[[TurnContext, TurnState], Awaitable[None]]]: + """Register a handler for user un-deletion lifecycle events. + + This is a convenience decorator that registers a handler specifically for + agentic user identity un-deletion events. + + Args: + **kwargs: Additional keyword arguments passed to the app's add_route method. + + Returns: + A decorator function that registers the handler with the application. + + Example: + ```python + @notifications.on_user_undeleted() + async def handle_user_undeleted(context, state, notification): + print("Agentic user identity un-deleted") + ``` + """ + return self.on_lifecycle_notification(AgentLifecycleEvent.USERUNDELETED, **kwargs) + + def on_user_updated( + self, **kwargs: Any + ) -> Callable[[AgentHandler], Callable[[TurnContext, TurnState], Awaitable[None]]]: + """Register a handler for user updated lifecycle events. + + This is a convenience decorator that registers a handler specifically for + agentic user identity updated events. + + Args: + **kwargs: Additional keyword arguments passed to the app's add_route method. + + Returns: + A decorator function that registers the handler with the application. + + Example: + ```python + @notifications.on_user_updated() + async def handle_user_updated(context, state, notification): + print("Agentic user identity updated") + ``` + """ + return self.on_lifecycle_notification(AgentLifecycleEvent.USERUPDATED, **kwargs) + + def on_user_manager_updated( + self, **kwargs: Any + ) -> Callable[[AgentHandler], Callable[[TurnContext, TurnState], Awaitable[None]]]: + """Register a handler for user manager updated lifecycle events. + + This is a convenience decorator that registers a handler specifically for + agentic user manager updated events. + + Args: + **kwargs: Additional keyword arguments passed to the app's add_route method. + + Returns: + A decorator function that registers the handler with the application. + + Example: + ```python + @notifications.on_user_manager_updated() + async def handle_user_manager_updated(context, state, notification): + print("Agentic user manager updated") + ``` + """ + return self.on_lifecycle_notification(AgentLifecycleEvent.USERMANAGERUPDATED, **kwargs) + @staticmethod def _normalize_subchannel(value: str | AgentSubChannel | None) -> str: """Normalize a subchannel value to a lowercase string. diff --git a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py index 9b4b15d8..d31fb432 100644 --- a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py +++ b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py @@ -19,4 +19,7 @@ class AgentLifecycleEvent(str, Enum): USERCREATED = "agenticuseridentitycreated" USERWORKLOADONBOARDINGUPDATED = "agenticuserworkloadonboardingupdated" - USERDELETED = "agenticuseridentitydeleted" + USERDELETED = "agenticuserdeleted" + USERUNDELETED = "agenticuserundeleted" + USERUPDATED = "agenticuseridentityupdated" + USERMANAGERUPDATED = "agenticusermanagerupdated" From 955251c20e1f20c7c3b0276bd369903b2fbfef1f Mon Sep 17 00:00:00 2001 From: edle Date: Thu, 19 Mar 2026 17:21:03 -0400 Subject: [PATCH 2/4] Taking copilot's comments --- .../notifications/agent_notification.py | 6 +++--- .../notifications/models/agent_lifecycle_event.py | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py index 869490a6..3c423433 100644 --- a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py +++ b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py @@ -449,7 +449,7 @@ async def handle_user_undeleted(context, state, notification): """ return self.on_lifecycle_notification(AgentLifecycleEvent.USERUNDELETED, **kwargs) - def on_user_updated( + def on_user_updated( self, **kwargs: Any ) -> Callable[[AgentHandler], Callable[[TurnContext, TurnState], Awaitable[None]]]: """Register a handler for user updated lifecycle events. @@ -472,7 +472,7 @@ async def handle_user_updated(context, state, notification): """ return self.on_lifecycle_notification(AgentLifecycleEvent.USERUPDATED, **kwargs) - def on_user_manager_updated( + def on_user_manager_updated( self, **kwargs: Any ) -> Callable[[AgentHandler], Callable[[TurnContext, TurnState], Awaitable[None]]]: """Register a handler for user manager updated lifecycle events. @@ -493,7 +493,7 @@ async def handle_user_manager_updated(context, state, notification): print("Agentic user manager updated") ``` """ - return self.on_lifecycle_notification(AgentLifecycleEvent.USERMANAGERUPDATED, **kwargs) + return self.on_lifecycle_notification(AgentLifecycleEvent.USERMANAGERUPDATED, **kwargs) @staticmethod def _normalize_subchannel(value: str | AgentSubChannel | None) -> str: diff --git a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py index d31fb432..1877a01b 100644 --- a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py +++ b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py @@ -15,6 +15,9 @@ class AgentLifecycleEvent(str, Enum): USERWORKLOADONBOARDINGUPDATED: Event triggered when a user's workload onboarding status is updated. USERDELETED: Event triggered when an agentic user identity is deleted. + USERUNDELETED: Event triggered when an agentic user identity is un-deleted. + USERUPDATED: Event triggered when an agentic user identity is updated. + USERMANAGERUPDATED: Event triggered when an agentic user's manager is updated. """ USERCREATED = "agenticuseridentitycreated" From 557051e2107f3421ced380a15a8085b2b42dcfe4 Mon Sep 17 00:00:00 2001 From: edle Date: Mon, 20 Apr 2026 12:16:20 -0400 Subject: [PATCH 3/4] Adding agentic user enabled/disabled events --- .../notifications/agent_notification.py | 46 +++++++++++++++++++ .../models/agent_lifecycle_event.py | 4 ++ 2 files changed, 50 insertions(+) diff --git a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py index 3c423433..c600aacc 100644 --- a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py +++ b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py @@ -495,6 +495,52 @@ async def handle_user_manager_updated(context, state, notification): """ return self.on_lifecycle_notification(AgentLifecycleEvent.USERMANAGERUPDATED, **kwargs) + def on_user_enabled( + self, **kwargs: Any + ) -> Callable[[AgentHandler], Callable[[TurnContext, TurnState], Awaitable[None]]]: + """Register a handler for user enabled lifecycle events. + + This is a convenience decorator that registers a handler specifically for + agentic user enabled events. + + Args: + **kwargs: Additional keyword arguments passed to the app's add_route method. + + Returns: + A decorator function that registers the handler with the application. + + Example: + ```python + @notifications.on_user_enabled() + async def handle_user_enabled(context, state, notification): + print("Agentic user enabled") + ``` + """ + return self.on_lifecycle_notification(AgentLifecycleEvent.USERENABLED, **kwargs) + + def on_user_disabled( + self, **kwargs: Any + ) -> Callable[[AgentHandler], Callable[[TurnContext, TurnState], Awaitable[None]]]: + """Register a handler for user disabled lifecycle events. + + This is a convenience decorator that registers a handler specifically for + agentic user disabled events. + + Args: + **kwargs: Additional keyword arguments passed to the app's add_route method. + + Returns: + A decorator function that registers the handler with the application. + + Example: + ```python + @notifications.on_user_disabled() + async def handle_user_disabled(context, state, notification): + print("Agentic user disabled") + ``` + """ + return self.on_lifecycle_notification(AgentLifecycleEvent.USERDISABLED, **kwargs) + @staticmethod def _normalize_subchannel(value: str | AgentSubChannel | None) -> str: """Normalize a subchannel value to a lowercase string. diff --git a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py index 1877a01b..0bf644e6 100644 --- a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py +++ b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py @@ -18,6 +18,8 @@ class AgentLifecycleEvent(str, Enum): USERUNDELETED: Event triggered when an agentic user identity is un-deleted. USERUPDATED: Event triggered when an agentic user identity is updated. USERMANAGERUPDATED: Event triggered when an agentic user's manager is updated. + USERENABLED: Event triggered when an agentic user is enabled. + USERDISABLED: Event triggered when an agentic user is disabled. """ USERCREATED = "agenticuseridentitycreated" @@ -26,3 +28,5 @@ class AgentLifecycleEvent(str, Enum): USERUNDELETED = "agenticuserundeleted" USERUPDATED = "agenticuseridentityupdated" USERMANAGERUPDATED = "agenticusermanagerupdated" + USERENABLED = "agenticuserenabled" + USERDISABLED = "agenticuserdisabled" \ No newline at end of file From 40a422d1a15cf3b7a920d299cc922ac9ef5232aa Mon Sep 17 00:00:00 2001 From: Grant Harris Date: Wed, 22 Apr 2026 14:27:42 -0700 Subject: [PATCH 4/4] fix formatting --- .../notifications/models/agent_lifecycle_event.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py index 0bf644e6..bfebedf1 100644 --- a/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py +++ b/libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py @@ -29,4 +29,4 @@ class AgentLifecycleEvent(str, Enum): USERUPDATED = "agenticuseridentityupdated" USERMANAGERUPDATED = "agenticusermanagerupdated" USERENABLED = "agenticuserenabled" - USERDISABLED = "agenticuserdisabled" \ No newline at end of file + USERDISABLED = "agenticuserdisabled"