Skip to content

CallableAgentResolver

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Resolves, from the catalog, the other agents an agent may call.

public sealed class CallableAgentResolver

objectCallableAgentResolver

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

The catalog is intentionally resolved late. The dependency graph would otherwise be circular: IAgentCatalogIAgentSourceAgentDefinitionCompiler → 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.

Creates a new resolver.

public CallableAgentResolver(IServiceProvider services)

services IServiceProvider

Service provider from which the catalog is resolved.

ArgumentNullException

services is null.

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)

callableAgentNames IReadOnlyList<string>

Names to resolve.

cancellationToken CancellationToken

Cancellation token.

ValueTask<IReadOnlyList<CallableAgentInfo>>

Name/description pairs; the description is empty for names not present in the catalog.

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.

Lists the agent summaries in the catalog.

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

cancellationToken CancellationToken

Cancellation token.

ValueTask<IReadOnlyList<AgentDescriptor>>

Agent summaries.

Resolves the agent with the given name.

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

agentName string

Agent name.

cancellationToken CancellationToken

Cancellation token.

ValueTask<AIAgent?>

The agent wrapped with the run-recording wrapper; null when absent.