AzureAI.Community.SK.Agents.Resolver
1.0.0-preview
dotnet add package AzureAI.Community.SK.Agents.Resolver --version 1.0.0-preview
NuGet\Install-Package AzureAI.Community.SK.Agents.Resolver -Version 1.0.0-preview
<PackageReference Include="AzureAI.Community.SK.Agents.Resolver" Version="1.0.0-preview" />
<PackageVersion Include="AzureAI.Community.SK.Agents.Resolver" Version="1.0.0-preview" />
<PackageReference Include="AzureAI.Community.SK.Agents.Resolver" />
paket add AzureAI.Community.SK.Agents.Resolver --version 1.0.0-preview
#r "nuget: AzureAI.Community.SK.Agents.Resolver, 1.0.0-preview"
#:package AzureAI.Community.SK.Agents.Resolver@1.0.0-preview
#addin nuget:?package=AzureAI.Community.SK.Agents.Resolver&version=1.0.0-preview&prerelease
#tool nuget:?package=AzureAI.Community.SK.Agents.Resolver&version=1.0.0-preview&prerelease
Azure AI Community Semantic Kernel Agents Resolver
AgentResolver
The AgentResolver
class is a utility for resolving instances of agents registered in a .NET application's dependency injection (DI) container. It is designed to work with the Microsoft.SemanticKernel.Agents library and provides a convenient way to retrieve agent instances by type and key.
📘 What is AgentResolver?
AgentResolver
implements the IAgentResolver
interface and acts as a factory for returning one or more Agent
instances based on a specified type and optional keys. It leverages the DI container to resolve agents, supporting scenarios where multiple agents of the same type are registered with different keys.
🕒 When to Use
Use AgentResolver
when:
- You have multiple agent implementations registered in your DI container.
- You need to resolve specific agents by type and key at runtime.
- You want a centralized, type-safe way to retrieve agent instances.
🚀 Features
- Resolves agents by type and key using IServiceProvider.
- Ensure your agents implement the
Agent
class from Microsoft.SemanticKernel.Agents. - Skips missing agents silently — no exceptions thrown.
- Returns null if no matching agents are found.
- Works with Microsoft.SemanticKernel.Agents.
- Clean interface-based design for unit testing and mocking.
- Centralized agent resolution logic for better maintainability.
⚙️ How to Use
1. Register Agents in DI
Register your agent implementations in the DI container, optionally using keys:
builder.Services.AddKeyedSingleton<ChatCompletionAgent>("agent1");
builder.Services.AddKeyedSingleton<ChatCompletionAgent>("agent2");
2. Inject AgentResolver
builder.Services.AddSingleton<IAgentResolver, AgentResolver>();
3. Resolve Agents
IAgentResolver agentResolver = sp.GetRequiredService<IAgentResolver>();
Agent[]? agents = agentResolver.ResolveAgents(typeof(ChatCompletionAgent), "agent1","agent2");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.SemanticKernel.Agents.Core (>= 1.58.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|