From e0846b252a423e52eaf96183a0adfa76fb258208 Mon Sep 17 00:00:00 2001 From: edle Date: Wed, 18 Mar 2026 12:36:48 -0400 Subject: [PATCH 1/2] 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/2] 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"