-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Labels
TeamsThis is related to Microsoft TeamsThis is related to Microsoft Teams
Description
Hello,
My bot uses a conversation reference store to send proactive messages.
In my ConversationBot, the ConversationStore.Add function is being called once for each bot.
I’m using four agents in a single application, based on the Multi-Agent sample.
// Program.cs
builder.Services.AddTransient<Func<string, IAgent>>(sp => key =>
{
return key switch
{
"1" => sp.GetRequiredService<Agent1>(),
"2" => sp.GetRequiredService<Agent2>(),
"3" => sp.GetRequiredService<Agent2>(),
"4" => sp.GetRequiredService<Agent2>(),
_ => throw new ArgumentException($"Unknown agent type: {key}"),
};
});
app.MapPost("/api/{type}/{version}/messages", async (
HttpRequest request,
HttpResponse response,
IAgentHttpAdapter adapter,
string type,
string version,
Func<string, IAgent> agentResolver,
CancellationToken cancellationToken) =>
{
var key = $"{type}{version}";
var agent = agentResolver(key);
await adapter.ProcessAsync(request, response, agent, cancellationToken);
});{
"TokenValidation": {
"Audiences": [
"{{ClientId1}}",
"{{ClientId2}}",
"{{ClientId3}}",
"{{ClientId4}}"
]
},
"Connections": {
"ServiceConnection1": {
"Settings": {
"AuthType": "ClientSecret",
"AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}",
"ClientId": "{{ClientId1}}", // this is the Client ID used for Azure Bot 1
"ClientSecret": "", // this is the Client Secret for Azure Bot 1.
"Scopes": [
"https://api.botframework.com/.default"
]
}
},
"ServiceConnection2": {
"Settings": {
"AuthType": "ClientSecret",
"AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}",
"ClientId": "{{ClientId2}}", // this is the Client ID used for Azure Bot 2
"ClientSecret": "", // this is the Client Secret for Azure Bot 2.
"Scopes": [
"https://api.botframework.com/.default"
]
}
},
"ServiceConnection3": {
"Settings": {
"AuthType": "ClientSecret",
"AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}",
"ClientId": "{{ClientId3}}", // this is the Client ID used for Azure Bot 3
"ClientSecret": "", // this is the Client Secret for Azure Bot 3.
"Scopes": [
"https://api.botframework.com/.default"
]
}
},
"ServiceConnection4": {
"Settings": {
"AuthType": "ClientSecret",
"AuthorityEndpoint": "https://login.microsoftonline.com/{{TenantId}}",
"ClientId": "{{ClientId2}}", // this is the Client ID used for Azure Bot 4
"ClientSecret": "", // this is the Client Secret for Azure Bot 4.
"Scopes": [
"https://api.botframework.com/.default"
]
}
}
},
"ConnectionsMap": [
{
"Audience": "{{ClientId1}}",
"Connection": "ServiceConnection1"
},
{
"Audience": "{{ClientId2}}",
"Connection": "ServiceConnection2"
},
{
"Audience": "{{ClientId3}}",
"Connection": "ServiceConnection3"
},
{
"Audience": "{{ClientId4}}",
"Connection": "ServiceConnection4"
}
],
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}When I install a specific agent in my Teams app, I see four add requests, one for each agent ID.
However, when the agent is removed, only one remove request (corresponding to that specific agent) is triggered.
Why does this happen?
Thanks!
Metadata
Metadata
Assignees
Labels
TeamsThis is related to Microsoft TeamsThis is related to Microsoft Teams