Add app-level agentic send helpers#480
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
fd83c83 to
d1219ac
Compare
60f8575 to
c6f3c86
Compare
d1219ac to
123df7d
Compare
c6f3c86 to
19d2ace
Compare
123df7d to
fe6b8c5
Compare
19d2ace to
96d043f
Compare
fe6b8c5 to
1b0b92d
Compare
96d043f to
615be85
Compare
1b0b92d to
d9fb845
Compare
f2998f1 to
8b70f4c
Compare
d9fb845 to
28b42b4
Compare
8b70f4c to
08aff1c
Compare
28b42b4 to
9a47d7b
Compare
08aff1c to
0aad1e2
Compare
9a47d7b to
bd67034
Compare
0aad1e2 to
81ee3d1
Compare
bd67034 to
703a53d
Compare
81ee3d1 to
787b1c2
Compare
703a53d to
dd092e4
Compare
787b1c2 to
3832165
Compare
| self.api = ApiClient( | ||
| service_url, | ||
| self.http_client.clone(ClientOptions(token=self._get_bot_token)), | ||
| self.http_client, |
There was a problem hiding this comment.
This removes the bot token from the HTTP client. _get_agentic_token returns None when there's no agentic identity, and nothing else provides a default token, so all non-agentic outbound API calls will be unauthenticated. Was this intentional?
There was a problem hiding this comment.
The auth provider should call get_app_token if agentic_identity is none:
There was a problem hiding this comment.
The problem is auth_provider.token is never called for non-agentic requests.
There was a problem hiding this comment.
Ah shit. You're right. That's bad. Nice catch!
| self.http_client, | ||
| self.api_client_settings, | ||
| auth_provider=self.auth_provider, | ||
| agentic_identity=activity.recipient.agentic_identity, |
There was a problem hiding this comment.
recipient is Optional[Account] & this will crash with AttributeError for any inbound activity without a recipient. Since _build_context runs for every activity, this could break the full flow.
There was a problem hiding this comment.
Hmm recipient is actually Account on ActivityBase so it should be okay.
| self.default_connection_name = default_connection_name | ||
| self.http_client = http_client | ||
| self.token_manager = token_manager | ||
| self.auth_provider = AppAuthProvider(token_manager) |
There was a problem hiding this comment.
This omits credentials, as opposed to App._init_. tenant_id fallback in AppAuthProvider.token() won't work in reactive flows.
There was a problem hiding this comment.
token_manager, uses the tenant id from the credentials if not passed in. is that what you meant?
But maybe herer we can just pass app authprovider instead of reconstructing it with tokemanager.
dd092e4 to
f305e45
Compare
3832165 to
1996701
Compare
6088587 to
54dc844
Compare
a665861 to
37ab4be
Compare
54dc844 to
a9ef9ab
Compare
37ab4be to
87f196e
Compare
a9ef9ab to
cbadaff
Compare
87f196e to
e1308b3
Compare
cbadaff to
f7b9a58
Compare
e1308b3 to
f207765
Compare
corinagum
left a comment
There was a problem hiding this comment.
LGTM, thanks for addressing the feedback for all the Agentic Identity PRs
f7b9a58 to
e874de7
Compare
f207765 to
867eea1
Compare
e874de7 to
e4f974b
Compare
867eea1 to
978dfa9
Compare
e4f974b to
fd063c1
Compare
978dfa9 to
ad51a6e
Compare
fd063c1 to
408095b
Compare
1797e5b to
6851e6b
Compare
# Conflicts: # packages/apps/src/microsoft_teams/apps/routing/activity_context.py
6851e6b to
49b98f7
Compare
Adds app-level reactive and proactive helpers on top of the AgenticIdentity API surface.
Why:
The lower branches teach the API client how to send with
agentic_identity. This branch wires that into the developer-facing app flows.Reactive flow:
Proactive app helper:
Interesting bits:
ctx.apiis scoped with the inbound Agent ID identity when present.ctx.send/ctx.replyuse the inbound service URL and identity through the API layer.ActivityProcessornow receives the app's existing auth provider instead of rebuilding one without credentials.app.send(..., agentic_identity=...)is a convenience over the same API operation path.Reviewer tips:
Start with
examples/agent365/src/main.py, thenActivityProcessorandActivityContext.send.Testing:
Live smoke tested with Agent ID token:
Known limitation: