Soenneker.SemanticKernel.Pool
4.0.449
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.SemanticKernel.Pool --version 4.0.449
NuGet\Install-Package Soenneker.SemanticKernel.Pool -Version 4.0.449
<PackageReference Include="Soenneker.SemanticKernel.Pool" Version="4.0.449" />
<PackageVersion Include="Soenneker.SemanticKernel.Pool" Version="4.0.449" />
<PackageReference Include="Soenneker.SemanticKernel.Pool" />
paket add Soenneker.SemanticKernel.Pool --version 4.0.449
#r "nuget: Soenneker.SemanticKernel.Pool, 4.0.449"
#:package Soenneker.SemanticKernel.Pool@4.0.449
#addin nuget:?package=Soenneker.SemanticKernel.Pool&version=4.0.449
#tool nuget:?package=Soenneker.SemanticKernel.Pool&version=4.0.449
Soenneker.SemanticKernel.Pool
A keyed collection of Semantic Kernel configurations with per-entry request quotas and cached kernel construction.
Installation
dotnet add package Soenneker.SemanticKernel.Pool
Registration
using Soenneker.SemanticKernel.Pool.Registrars;
services.AddSemanticKernelPoolAsSingleton();
AddSemanticKernelPoolAsScoped() is also available. Both registrations use the singleton Semantic Kernel cache, so cached kernels can survive disposal of a scoped pool.
Add an entry
Each entry belongs to a named sub-pool and must specify its KernelType:
using Microsoft.SemanticKernel;
using Soenneker.SemanticKernel.Dtos.Options;
using Soenneker.SemanticKernel.Enums.KernelType;
using Soenneker.SemanticKernel.Pool.Abstract;
var options = new SemanticKernelOptions
{
Type = KernelType.Chat,
ModelId = "primary-chat-model",
RequestsPerSecond = 2,
RequestsPerMinute = 60,
RequestsPerDay = 1_000,
KernelFactory = static (options, cancellationToken) =>
{
IKernelBuilder builder = Kernel.CreateBuilder();
// Add the connector for options.ModelId, Endpoint, and ApiKey.
return ValueTask.FromResult(builder);
}
};
await pool.Add("chat", "primary", options, cancellationToken);
Provider-specific pool packages can create these options and connector registrations for OpenAI, Azure OpenAI, Gemini, Mistral, and Ollama.
Acquire a kernel
(Kernel? kernel, IKernelPoolEntry? entry) =
await pool.GetAvailable("chat", KernelType.Chat, cancellationToken);
if (kernel is null || entry is null)
return;
// Resolve and use the services configured by the entry's KernelFactory.
The pool checks matching entries in insertion order and returns the first entry whose quota can be consumed. It is not round-robin. If none is available, GetAvailable waits 500 ms and tries again until an entry becomes available or cancellation stops the operation.
Acquisition counts as one request against every configured request window. TokensPerDay also counts one unit per acquisition through this API; the pool does not inspect the provider response or actual model-token usage.
Inspect the remaining request quotas when needed:
Dictionary<string, (int Second, int Minute, int Day)> quotas =
await pool.GetRemainingQuotas("chat", cancellationToken);
An unconfigured quota is reported as int.MaxValue.
Remove entries
bool removed = await pool.Remove("chat", "primary", cancellationToken);
await pool.Clear("chat", cancellationToken);
await pool.ClearAll(cancellationToken);
Entry keys should be unique across all sub-pools. The underlying kernel cache is keyed by entryKey, not by the combination of poolId and entryKey.
Remove evicts the removed entry's cached kernel. Clear(poolId) removes that sub-pool and clears the shared kernel cache, including kernels cached for other sub-pools. ClearAll removes every sub-pool and clears the cache.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Soenneker.SemanticKernel.Cache (>= 4.0.871)
- Soenneker.Utils.Delay (>= 4.0.96)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Soenneker.SemanticKernel.Pool:
| Package | Downloads |
|---|---|
|
Soenneker.SemanticKernel.Pool.Gemini
Gemini connector registration extensions for Soenneker.SemanticKernel.Pool. |
|
|
Soenneker.SemanticKernel.Pool.Mistral
Mistral connector registration extensions for Soenneker.SemanticKernel.Pool. |
|
|
Soenneker.SemanticKernel.Pool.OpenAi
OpenAI connector registration extensions for Soenneker.SemanticKernel.Pool. |
|
|
Soenneker.SemanticKernel.Pool.OpenAi.Azure
Azure OpenAI connector registration extensions for Soenneker.SemanticKernel.Pool. |
|
|
Soenneker.SemanticKernel.Pool.Ollama
Ollama connector registration extensions for Soenneker.SemanticKernel.Pool. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.455 | 235 | 10/15/2026 |
| 4.0.454 | 92 | 10/15/2026 |
| 4.0.453 | 131 | 10/14/2026 |
| 4.0.452 | 151 | 10/14/2026 |
| 4.0.451 | 149 | 10/14/2026 |
| 4.0.450 | 106 | 10/14/2026 |
| 4.0.449 | 153 | 10/14/2026 |
| 4.0.442 | 186 | 10/13/2026 |
| 4.0.441 | 172 | 10/13/2026 |
| 4.0.440 | 107 | 10/12/2026 |
| 4.0.439 | 206 | 10/12/2026 |
| 4.0.438 | 207 | 10/12/2026 |
| 4.0.437 | 110 | 10/11/2026 |
| 4.0.436 | 144 | 10/11/2026 |
| 4.0.435 | 216 | 10/11/2026 |
| 4.0.434 | 113 | 10/11/2026 |
| 4.0.433 | 287 | 10/6/2026 |
| 4.0.432 | 160 | 10/6/2026 |
| 4.0.431 | 224 | 9/30/2026 |
| 4.0.430 | 201 | 9/30/2026 |
Use NuGet API token for publishing