Skip to content

DefinitionStoreAgentSource

Namespace AgentPrism · Assembly AgentPrism.Core.dll

A source that exposes definitions from IAgentDefinitionStore in the catalog. Agents created through the UI come from this source.

public sealed class DefinitionStoreAgentSource : IVersionedAgentSource, IAgentSource

objectDefinitionStoreAgentSource

IVersionedAgentSource, IAgentSource

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

DefinitionStoreAgentSource(IAgentDefinitionStore, AgentDefinitionCompiler, CompiledAgentCache, ITenantContext)

Section titled “ DefinitionStoreAgentSource(IAgentDefinitionStore, AgentDefinitionCompiler, CompiledAgentCache, ITenantContext)”

Initializes a new database source.

public DefinitionStoreAgentSource(IAgentDefinitionStore store, AgentDefinitionCompiler compiler, CompiledAgentCache cache, ITenantContext tenantContext)

store IAgentDefinitionStore

The definition store.

compiler AgentDefinitionCompiler

The compiler that compiles definitions.

cache CompiledAgentCache

The compiled agent cache.

tenantContext ITenantContext

The tenant context. It is required to add the tenant to the cache key. See the tenant note in CompiledAgentCache.

ArgumentNullException

A dependency is null.

Gets the name of the source, used for diagnostics and user interface badges.

public string Name { get; }

string

Gets the resolution priority. A lower value is tried first. When two agents share a name, the source with priority wins.

public int Priority { get; }

int

The values in use: 0 for the code source, 10 for the MAF hosting source, 100 for the database source.

Lists every agent in this source.

public ValueTask<IReadOnlyList<AgentDescriptor>> ListAsync(CancellationToken cancellationToken = default)

cancellationToken CancellationToken

The cancellation token.

ValueTask<IReadOnlyList<AgentDescriptor>>

The agent summaries.

ResolveAsync(string, string?, CancellationToken)

Section titled “ ResolveAsync(string, string?, CancellationToken)”

Resolves the agent with the given name and makes it runnable.

public ValueTask<AIAgent?> ResolveAsync(string agentName, string? culture = null, CancellationToken cancellationToken = default)

agentName string

The agent name.

culture string?

The requested culture, resolved against the definition’s culture-keyed instructions (see AgentDefinition.InstructionsByCulture). null uses the definition’s default instructions.

cancellationToken CancellationToken

The cancellation token.

ValueTask<AIAgent?>

The agent, or null when this source does not hold it.

ResolveVersionAsync(string, int, string?, CancellationToken)

Section titled “ ResolveVersionAsync(string, int, string?, CancellationToken)”

Resolves an agent by name and by a specific version.

public ValueTask<AIAgent?> ResolveVersionAsync(string agentName, int version, string? culture = null, CancellationToken cancellationToken = default)

agentName string

The agent name.

version int

The requested definition version.

culture string?

The requested culture, resolved against the definition’s culture-keyed instructions (see AgentDefinition.InstructionsByCulture). null uses the definition’s default instructions.

cancellationToken CancellationToken

The cancellation token.

ValueTask<AIAgent?>

The agent, or null when this source does not hold it or that version does not exist.