Add Agent 365 agentLifecycle event support#492
Open
heyitsaamir wants to merge 3 commits into
Open
Conversation
Model and route Agent 365 "agentLifecycle" event activities, which arrive as event activities (name="agentLifecycle") from the System user on the "agents" channel. The activity-level valueType names the variant and value carries the typed payload. - Add Pydantic models for the 8 agentLifecycle payloads, discriminated by eventType, with an unknown fallback (mirrors the Entity discriminator). - Add one typed activity class per variant plus an AgentLifecycleEventActivity union. - Switch EventActivity from a name-based discriminator to a callable Discriminator so agentLifecycle variants discriminate on valueType while meeting/read-receipt events still discriminate on name. - Add routing configs and regenerate handlers to expose on_agent_lifecycle plus per-variant on_agentic_user_* registration methods. - Add API parsing tests and apps route-selector tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agentLifecycleevent activity models and value payloads for the observed lifecycle variants.agentLifecycleintoEventActivityparsing via nested discriminators (namethenvalueType).on_agent_lifecycleand per-varianton_agentic_user_*handlers.examples/agent365as a runnable validation/reference harness.uv.lockso the existingexamples/formatted-messagingworkspace member is represented in the lockfile.Manual validation
Validated against live Agent 365 lifecycle traffic using
examples/agent365on port 4000 with handlers registered for both the general lifecycle event and each variant-specific lifecycle event.AgenticUserIdentityCreateduserId,email, anddisplayName.AgenticUserIdentityUpdatedMail,Alias, andUserPrincipalNameupdates with versions.AgenticUserEnabledAgenticUserDisabledAgenticUserManagerUpdatedmanager.managerId.AgenticUserWorkloadOnboardingUpdatedworkloadName=TeamsandworkloadOnboardingState=succeeded.AgenticUserDeletedAgenticUserUndeletedAgenticUserDeletedAdditional live-test findings:
type="event",name="agentLifecycle",channelId="agents", andfrom.id="system".valueTypematched the concrete lifecycle variant andvalue.eventTypematched the lower-camel event name.await ctx.next()for variant-specific handlers to run afterward.AgenticUserDeleted; live payloads did not include a populated deletion reason, so the model keeps it optional.AgenticUserManagerUpdated; updating the primary Entra manager did.200 OKand Bot API reply returned201 Created.Validation
ruff checkpyrightpytest packages