Skip to content

IModelProviderRegistry

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

The registry that keeps registered model providers by name.

public interface IModelProviderRegistry

Produces a chat client for the given binding, using the provider’s setup-time credential.

IChatClient CreateChatClient(ModelBinding binding)

binding ModelBinding

The model binding.

IChatClient

The chat client.

This overload does not resolve a tenant provider binding (BYOK) or check an egress policy: both need an async store lookup, which this synchronous method cannot perform. Callers that must honor a tenant’s own credential and egress policy — this includes the real agent-run compile path — use IModelProviderRegistry.CreateChatClientAsync instead.

AgentPrismException

No provider is registered with the name in ModelBinding.Provider.

CreateChatClientAsync(ModelBinding, CancellationToken)

Section titled “ CreateChatClientAsync(ModelBinding, CancellationToken)”

Produces a chat client for the given binding, first resolving the current tenant’s own provider credential and egress policy.

ValueTask<IChatClient> CreateChatClientAsync(ModelBinding binding, CancellationToken cancellationToken = default)

binding ModelBinding

The model binding.

cancellationToken CancellationToken

The cancellation token.

ValueTask<IChatClient>

The chat client.

When no tenant context is registered, or the tenant has no binding for the provider, behavior is identical to IModelProviderRegistry.CreateChatClient (the no-surprises rule: zero surprise when BYOK is not configured).

AgentPrismException

No provider is registered with the name in ModelBinding.Provider, the tenant’s egress policy does not allow the provider, or the tenant’s provider binding cannot be resolved to a credential value.

HasTenantProviderOverrideAsync(ModelBinding, CancellationToken)

Section titled “ HasTenantProviderOverrideAsync(ModelBinding, CancellationToken)”

Reports whether the current tenant has its own provider binding for binding’s primary provider or any of its ModelBinding.Fallbacks (BYOK).

ValueTask<bool> HasTenantProviderOverrideAsync(ModelBinding binding, CancellationToken cancellationToken = default)

binding ModelBinding

The model binding to check.

cancellationToken CancellationToken

The cancellation token.

ValueTask<bool>

true if a tenant-specific credential would be baked into the chat client IModelProviderRegistry.CreateChatClientAsync produces for this binding.

A compiled agent’s chat client is a fixed pipeline object — once a tenant’s credential is resolved into it, changing or deleting the underlying binding has no further effect on that object. A cache keyed only by definition identity (CompiledAgentCache) must therefore never hold an agent built with a tenant-specific credential; callers use this method to decide whether to bypass that cache.

Returns the definitions of the registered providers.

IReadOnlyList<ModelProviderDescriptor> List()

IReadOnlyList<ModelProviderDescriptor>

The provider definitions.