AzureAI.Community.SK.Agents.Resolver 1.0.0-preview

This is a prerelease version of AzureAI.Community.SK.Agents.Resolver.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AzureAI.Community.SK.Agents.Resolver" Version="1.0.0-preview" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AzureAI.Community.SK.Agents.Resolver" Version="1.0.0-preview" />
                    
Directory.Packages.props
<PackageReference Include="AzureAI.Community.SK.Agents.Resolver" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AzureAI.Community.SK.Agents.Resolver --version 1.0.0-preview
                    
#r "nuget: AzureAI.Community.SK.Agents.Resolver, 1.0.0-preview"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AzureAI.Community.SK.Agents.Resolver@1.0.0-preview
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AzureAI.Community.SK.Agents.Resolver&version=1.0.0-preview&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=AzureAI.Community.SK.Agents.Resolver&version=1.0.0-preview&prerelease
                    
Install as a Cake Tool

Azure AI Community GitHub

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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