.NET API
ModelProviderRegistry
Tracon.Core.dllRegistry that holds the registered IModelProvider implementations by name, and the single place that assembles the model-call pipeline.
public sealed class ModelProviderRegistry : IModelProviderRegistry- Inheritance
- object ← ModelProviderRegistry
- Implements
- IModelProviderRegistry
- Inherited Members
- object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”By default no provider is registered; the Tracon.OpenAI package
adds the first provider with UseOpenAI. Trying to compile
while no provider is registered produces a clear error.
The entire pipeline is assembled here.
Previously the four provider packages each assembled the
UseFunctionInvocation + UseOpenTelemetry chain
inside themselves; every ring the registry wrapped stayed OUTSIDE
that chain, making it impossible to write a ring that sees the tool-call
turns. Now IModelProvider returns the raw
client and the pipeline is assembled in a single place; a third-party
provider inherits every ring for free too.
AddTracon registers the registry as a singleton; resolve it as
IModelProviderRegistry with GetRequiredService<IModelProviderRegistry>.
Methods
Section titled “Methods”CreateChatClient(ModelBinding)
Section titled “ CreateChatClient(ModelBinding)”Produces a chat client for the given binding, using the provider’s setup-time credential.
public IChatClient CreateChatClient(ModelBinding binding)Parameters
Section titled “Parameters”binding ModelBinding
The model binding.
Returns
Section titled “Returns”IChatClient
The chat client.
Remarks
Section titled “Remarks”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.
Exceptions
Section titled “Exceptions”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.
public ValueTask<IChatClient> CreateChatClientAsync(ModelBinding binding, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”binding ModelBinding
The model binding.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IChatClient>
The chat client.
Remarks
Section titled “Remarks”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: behavior does not change until BYOK is configured).
Exceptions
Section titled “Exceptions”No provider is registered with the name in ModelBinding.Provider.
TraconTenantProviderRefusedException
The tenant’s egress policy does not allow the provider, the tenant’s provider binding cannot be resolved to a credential value, or the provider cannot take a tenant’s own credential.
CreateSetupChatClientAsync(ModelBinding, CancellationToken)
Section titled “ CreateSetupChatClientAsync(ModelBinding, CancellationToken)”Produces a chat client after applying the current tenant’s egress policy.
public ValueTask<IChatClient> CreateSetupChatClientAsync(ModelBinding binding, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”binding ModelBinding
The model binding.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<IChatClient>
The chat client.
Exceptions
Section titled “Exceptions”No provider is registered with the name in ModelBinding.Provider.
TraconTenantProviderRefusedException
The tenant’s egress policy does not allow the provider.
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).
public ValueTask<bool> HasTenantProviderOverrideAsync(ModelBinding binding, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”binding ModelBinding
The model binding to check.
cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”true if a tenant-specific credential would be baked into the chat client IModelProviderRegistry.CreateChatClientAsync produces for this binding.
Remarks
Section titled “Remarks”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.
List()
Section titled “ List()”Returns the definitions of the registered providers.
public IReadOnlyList<ModelProviderDescriptor> List()Returns
Section titled “Returns”IReadOnlyList<ModelProviderDescriptor>
The provider definitions.