Use AgenticIdentity as Python Agent 365 SDK scope - #533
Merged
heyitsaamir merged 13 commits intoJul 31, 2026
Conversation
Add AgenticIdentity as the canonical SDK operation scope over concrete agentic identities while keeping AgenticUser as the concrete activity-facing model. Rename request/proactive/auth plumbing to agentic_identity and keep AgenticUser convenience wrappers delegating to the canonical APIs. Preserve service-owned activity wire keys and literals such as agenticUserId and lifecycle agenticUser values. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b861cde5-a4a6-4d2b-9ca7-0a4f8ccda4ff
Update the Agent 365 proactive example CLI description to use the canonical AgenticIdentity operation-scope terminology. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b861cde5-a4a6-4d2b-9ca7-0a4f8ccda4ff
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reintroduces AgenticIdentity as the canonical operation/request scoping concept for Agent 365 (proactive/API/auth) flows, while keeping AgenticUser as the concrete activity-facing model. The change is applied across the apps layer, API client scoping, auth provider interfaces, and supporting tests/examples.
Changes:
- Introduces
AgenticIdentityas a type alias and threadsagentic_identitythrough API scoping/auth surfaces. - Updates API client scoping helpers/constants (
AGENTIC_IDENTITY_CLEAR,from_agentic_identity, etc.) while retainingfrom_agentic_userwrappers. - Migrates tests and the
examples/agent365sample to use the newagentic_identitysurface.
Show a summary per file
| File | Description |
|---|---|
| packages/apps/tests/test_token_manager.py | Updates token-manager tests to prefer agentic_identity and adds dispatch coverage for identity token helper. |
| packages/apps/tests/test_app.py | Updates proactive send/reply tests to pass agentic_identity through app and API clone scoping. |
| packages/apps/tests/test_app_process.py | Updates context-building test to assert scoping via agentic_identity. |
| packages/apps/tests/test_activity_context.py | Updates routing/context tests to scope API clones with agentic_identity. |
| packages/apps/src/microsoft_teams/apps/token_manager.py | Adds get_agentic_identity_token and updates token-provider dispatch/error messaging to prefer agentic_identity. |
| packages/apps/src/microsoft_teams/apps/routing/activity_context.py | Routes outbound sends using agentic_identity derived from inbound recipient agentic user. |
| packages/apps/src/microsoft_teams/apps/auth_provider.py | Renames auth-provider parameter surface to agentic_identity and routes to token-manager identity token helper. |
| packages/apps/src/microsoft_teams/apps/app.py | Renames proactive send/reply keyword surface to agentic_identity. |
| packages/apps/src/microsoft_teams/apps/app_process.py | Scopes API client creation using agentic_identity from inbound activity. |
| packages/apps/src/microsoft_teams/apps/activity_send.py | Scopes send_or_update_activity via agentic_identity for cloning the API client. |
| packages/api/tests/unit/test_user_client.py | Updates auth-provider test harnesses to accept agentic_identity. |
| packages/api/tests/unit/test_team_client.py | Updates team client tests to use agentic_identity scoping and auth-provider calls. |
| packages/api/tests/unit/test_reaction_client.py | Updates reaction client tests to use identity scoping and auth-provider calls. |
| packages/api/tests/unit/test_meeting_client.py | Updates meeting client tests to use identity scoping and auth-provider calls. |
| packages/api/tests/unit/test_conversation_client.py | Updates conversation client tests and flattened method kwargs to agentic_identity. |
| packages/api/tests/unit/test_bot_client.py | Updates bot token-provider test to reflect positional agentic_identity naming and auth-provider usage. |
| packages/api/tests/unit/test_base_client.py | Updates base-client auth harness naming/expectations to agentic_identity. |
| packages/api/tests/unit/test_api_client.py | Updates API client scoping/clone tests for agentic_identity and identity-clear constants. |
| packages/api/src/microsoft_teams/api/models/agentic_user.py | Introduces AgenticIdentity as a TypeAlias to AgenticUser and exports it. |
| packages/api/src/microsoft_teams/api/models/init.py | Re-exports AgenticIdentity from models. |
| packages/api/src/microsoft_teams/api/diagnostics/_constants.py | Renames telemetry auth-flow constant from agentic_user to agentic_identity. |
| packages/api/src/microsoft_teams/api/clients/conversation/client.py | Threads agentic_identity through conversation operations and scoping factory types. |
| packages/api/src/microsoft_teams/api/clients/conversation/activity.py | Threads agentic_identity through activity operations and scoping factory types. |
| packages/api/src/microsoft_teams/api/clients/bot/token_client.py | Extends bot token-provider dispatch to recognize agentic_identity keyword. |
| packages/api/src/microsoft_teams/api/clients/api_client.py | Renames default-scoping storage and clone surface to agentic_identity and adds identity-first helpers/constants. |
| packages/api/src/microsoft_teams/api/clients/_auth_provider.py | Updates the AuthProvider Protocol to agentic_identity. |
| packages/api/src/microsoft_teams/api/clients/init.py | Exports new identity-clear/constants/types from the clients package. |
| packages/api/src/microsoft_teams/api/auth/credentials.py | Updates TokenProvider typing to use agentic_identity. |
| examples/agent365/src/proactive.py | Updates sample to scope via agentic_identity and from_agentic_identity. |
| examples/agent365/README.md | Updates documentation to describe identity-based scoping with a concrete AgenticUser. |
Review details
Comments suppressed due to low confidence (1)
packages/apps/src/microsoft_teams/apps/app.py:383
- App.reply overloads only accept
agentic_identity. If reply previously acceptedagentic_user, callers using that keyword will now fail. Consider addingagentic_useras a deprecated alias in the overload signature for backwards-compatible typing.
*,
service_url: Optional[str] = None,
agentic_identity: Optional[AgenticIdentity] = None,
) -> SentActivity: ...
- Files reviewed: 30/30 changed files
- Comments generated: 11
- Review effort level: Lite
Reconcile PR #533 with the latest Agent 365 feature branch token-provider changes while preserving AgenticIdentity as the canonical request/proactive/API scope and AgenticUser as the concrete activity-facing model. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b861cde5-a4a6-4d2b-9ca7-0a4f8ccda4ff
Refresh PR #533 on top of the latest Agent 365 feature branch after merging main into the base branch. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b861cde5-a4a6-4d2b-9ca7-0a4f8ccda4ff
corinagum
reviewed
Jul 31, 2026
| caller_name: str | None = None, | ||
| ) -> Optional[TokenProtocol]: | ||
| """Get a resource token for a concrete agentic identity.""" | ||
| credentials = self._credentials |
Contributor
There was a problem hiding this comment.
validate agentic_user_id values here?
corinagum
approved these changes
Jul 31, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b861cde5-a4a6-4d2b-9ca7-0a4f8ccda4ff
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b861cde5-a4a6-4d2b-9ca7-0a4f8ccda4ff
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: b861cde5-a4a6-4d2b-9ca7-0a4f8ccda4ff
Keep AgenticIdentity app/user IDs optional until token fallback flows need concrete agentic app/user identifiers. Update the Agent 365 example wording and tests to reinforce the scope distinction. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 69dcf0c6-166e-4c59-8a3f-6c0b0c1d8071
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 69dcf0c6-166e-4c59-8a3f-6c0b0c1d8071
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 69dcf0c6-166e-4c59-8a3f-6c0b0c1d8071
Report user-backed AgenticIdentity token minting as agentic_user and reserve agentic_app for non-user agentic scoped tokens instead of the generic agentic_identity auth flow. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 69dcf0c6-166e-4c59-8a3f-6c0b0c1d8071
Use service-owned lifecycle payload names for agentic app instance and agent identity blueprint fields while preserving their wire aliases. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 69dcf0c6-166e-4c59-8a3f-6c0b0c1d8071
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 69dcf0c6-166e-4c59-8a3f-6c0b0c1c05d3
MehakBindra
approved these changes
Jul 31, 2026
This was referenced Jul 31, 2026
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
Use
AgenticIdentityas the Python Agent 365 operation scope for requests, proactive sends, and scoped API clients.Why
Agent 365 starts from a blueprint, which can create apps, which can optionally have users. So
agentic_app_blueprint_idis required, whileagentic_app_idandagentic_user_idstay optional until a token flow actually needs them.Interesting bits
get_agentic_user_tokenandget_agentic_app_token.agenticAppInstanceIdandagentIdentityBlueprintId.app_only,agentic_user, oragentic_app.Reviewer tips
Start with the
AgenticIdentitymodel, API client token dispatch, token manager/provider, and lifecycle value models. The main thing to watch is the intentional split between SDK-facing names and service-owned wire names.