CallableAgentResolver
AgentPrism.Core.dllResolves, from the catalog, the other agents an agent may call.
public sealed class CallableAgentResolverInheritance
Section titled “Inheritance”object ← CallableAgentResolver
Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”The catalog is intentionally resolved late. The
dependency graph would otherwise be circular: IAgentCatalog →
IAgentSource → AgentDefinitionCompiler → callable agents →
IAgentCatalog. Constructor injection from the container cannot
build this chain. The fix is to request the catalog on first use,
not at setup time; by then both sides are already set up.
The second and more valuable benefit of late resolution: a sub-agent is re-resolved on every call. When a sub-agent’s definition is updated, the calling agent’s compiled copy does not go stale; there is no need to carry the sub-agent’s version into the cache key.
Constructors
Section titled “Constructors”CallableAgentResolver(IServiceProvider)
Section titled “ CallableAgentResolver(IServiceProvider)”Creates a new resolver.
public CallableAgentResolver(IServiceProvider services)Parameters
Section titled “Parameters”services IServiceProvider
Service provider from which the catalog is resolved.
Exceptions
Section titled “Exceptions”services is null.
Methods
Section titled “Methods”DescribeAsync(IReadOnlyList<string>, CancellationToken)
Section titled “ DescribeAsync(IReadOnlyList<string>, CancellationToken)”Resolves callable agent names together with their descriptions.
public ValueTask<IReadOnlyList<CallableAgentInfo>> DescribeAsync(IReadOnlyList<string> callableAgentNames, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”callableAgentNames IReadOnlyList<string>
Names to resolve.
cancellationToken CancellationToken
Cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<CallableAgentInfo>>
Name/description pairs; the description is empty for names not present in the catalog.
Remarks
Section titled “Remarks”The description is included in the agent list sent to the model. A sub-agent without a description is one the model has no way of knowing when to call.
ListAsync(CancellationToken)
Section titled “ ListAsync(CancellationToken)”Lists the agent summaries in the catalog.
public ValueTask<IReadOnlyList<AgentDescriptor>> ListAsync(CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”cancellationToken CancellationToken
Cancellation token.
Returns
Section titled “Returns”ValueTask<IReadOnlyList<AgentDescriptor>>
Agent summaries.
ResolveAsync(string, CancellationToken)
Section titled “ ResolveAsync(string, CancellationToken)”Resolves the agent with the given name.
public ValueTask<AIAgent?> ResolveAsync(string agentName, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”agentName string
Agent name.
cancellationToken CancellationToken
Cancellation token.
Returns
Section titled “Returns”ValueTask<AIAgent?>
The agent wrapped with the run-recording wrapper; null when absent.