Add Python SDK support for new lifecycle event types#206
Add Python SDK support for new lifecycle event types#206eddie-lee-msft wants to merge 2 commits intomainfrom
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Pull request overview
Adds new agent lifecycle event types to the microsoft-agents-a365-notifications package so applications can register handlers for additional user lifecycle notifications.
Changes:
- Updated
AgentLifecycleEventenum values to align with new/updated lifecycle event type identifiers. - Added new convenience decorators on
AgentNotificationfor user undeleted/updated/manager-updated lifecycle events.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py | Extends/updates lifecycle event enum values to represent newly supported lifecycle event types. |
| libraries/microsoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py | Adds new on_user_* decorators for registering handlers for the new lifecycle event types. |
...icrosoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py
Outdated
Show resolved
Hide resolved
...icrosoft-agents-a365-notifications/microsoft_agents_a365/notifications/agent_notification.py
Outdated
Show resolved
Hide resolved
| USERWORKLOADONBOARDINGUPDATED = "agenticuserworkloadonboardingupdated" | ||
| USERDELETED = "agenticuseridentitydeleted" | ||
| USERDELETED = "agenticuserdeleted" | ||
| USERUNDELETED = "agenticuserundeleted" |
There was a problem hiding this comment.
Changing the string value of the existing AgentLifecycleEvent.USERDELETED enum member from the previous value is a breaking change for consumers who persisted/compared against the old event type. If both event types can still be observed, consider keeping the old value as a deprecated alias/additional enum member (and/or accepting both in routing) to preserve backward compatibility.
There was a problem hiding this comment.
This was not correct in the first place. .NET and NodeJS SDKs have the right value.
...gents-a365-notifications/microsoft_agents_a365/notifications/models/agent_lifecycle_event.py
Show resolved
Hide resolved
| """ | ||
| return self.on_lifecycle_notification(AgentLifecycleEvent.USERUNDELETED, **kwargs) |
There was a problem hiding this comment.
on_user_undeleted returns self.on_lifecycle_notification(...), but AgentNotification doesn’t define an on_lifecycle_notification method anywhere in this module (only on_agent_lifecycle_notification). This will raise AttributeError when the decorator is used. Either implement on_lifecycle_notification (possibly as an alias/wrapper) or update these convenience methods to call the correct existing lifecycle registration method.
There was a problem hiding this comment.
I am not quite sure why this comment was generated, there are existing "on_..." methods that call self.on_lifecycle_notification(...)
Add Python SDK support for new lifecycle event types