ChildAgentInvoker
AgentPrism.Core.dllWraps a sub-agent an agent may call; enforces depth, budget, and tenant limits and links the sub-run into the tree.
public sealed class ChildAgentInvoker : AIAgentInheritance
Section titled “Inheritance”object ← AIAgent ← ChildAgentInvoker
Inherited Members
Section titled “Inherited Members”AIAgent.GetService(Type, object?), AIAgent.GetService<TService>(object?), AIAgent.CreateSessionAsync(CancellationToken), AIAgent.SerializeSessionAsync(AgentSession, JsonSerializerOptions?, CancellationToken), AIAgent.DeserializeSessionAsync(JsonElement, JsonSerializerOptions?, CancellationToken), AIAgent.RunAsync(AgentSession?, AgentRunOptions?, CancellationToken), AIAgent.RunAsync(string, AgentSession?, AgentRunOptions?, CancellationToken), AIAgent.RunAsync(ChatMessage, AgentSession?, AgentRunOptions?, CancellationToken), AIAgent.RunAsync(IEnumerable<ChatMessage>, AgentSession?, AgentRunOptions?, CancellationToken), AIAgent.RunStreamingAsync(AgentSession?, AgentRunOptions?, CancellationToken), AIAgent.RunStreamingAsync(string, AgentSession?, AgentRunOptions?, CancellationToken), AIAgent.RunStreamingAsync(ChatMessage, AgentSession?, AgentRunOptions?, CancellationToken), AIAgent.RunStreamingAsync(IEnumerable<ChatMessage>, AgentSession?, AgentRunOptions?, CancellationToken), AIAgent.RunAsync<T>(AgentSession?, JsonSerializerOptions?, AgentRunOptions?, CancellationToken), AIAgent.RunAsync<T>(string, AgentSession?, JsonSerializerOptions?, AgentRunOptions?, CancellationToken), AIAgent.RunAsync<T>(ChatMessage, AgentSession?, JsonSerializerOptions?, AgentRunOptions?, CancellationToken), AIAgent.RunAsync<T>(IEnumerable<ChatMessage>, AgentSession?, JsonSerializerOptions?, AgentRunOptions?, CancellationToken), AIAgent.Id, AIAgent.Name, AIAgent.Description, AIAgent.CurrentRunContext, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”This is not an IAgentDecorator. Decorators apply to every agent resolved from the catalog; this wrapper only intervenes when one agent appears in another agent’s view. It does not touch the decorator order (recording 0 → telemetry 10 → approval 20).
The sub-agent is resolved late. This way, the calling agent’s compiled copy does not go stale when the sub-agent’s definition changes.
Microsoft Agent Framework calls the sub-agent with options = null
. Tree information therefore cannot be read from the
incoming options; the wrapper reads it from the AgentPrismRunContext
scope and builds the AgentPrismRunOptions object itself.
Constructors
Section titled “Constructors”ChildAgentInvoker(CallableAgentResolver, ITenantContext, ILogger, string, CallableAgentInfo)
Section titled “ ChildAgentInvoker(CallableAgentResolver, ITenantContext, ILogger, string, CallableAgentInfo)”Creates a new sub-agent wrapper.
public ChildAgentInvoker(CallableAgentResolver resolver, ITenantContext tenantContext, ILogger logger, string callerName, CallableAgentInfo child)Parameters
Section titled “Parameters”resolver CallableAgentResolver
Resolver that resolves the sub-agent from the catalog.
tenantContext ITenantContext
Tenant context.
logger ILogger
Logger.
callerName string
Name of the calling agent.
child CallableAgentInfo
Summary of the sub-agent being called.
Exceptions
Section titled “Exceptions”One of the required dependencies is null.
Properties
Section titled “Properties”Description
Section titled “ Description”public override string? Description { get; }Property Value
Section titled “Property Value”public override string Name { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”CreateSessionCoreAsync(CancellationToken)
Section titled “ CreateSessionCoreAsync(CancellationToken)”protected override ValueTask<AgentSession> CreateSessionCoreAsync(CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”cancellationToken CancellationToken
Returns
Section titled “Returns”ValueTask<AgentSession>
DeserializeSessionCoreAsync(JsonElement, JsonSerializerOptions?, CancellationToken)
Section titled “ DeserializeSessionCoreAsync(JsonElement, JsonSerializerOptions?, CancellationToken)”protected override ValueTask<AgentSession> DeserializeSessionCoreAsync(JsonElement serializedState, JsonSerializerOptions? jsonSerializerOptions = null, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”serializedState JsonElement
jsonSerializerOptions JsonSerializerOptions?
cancellationToken CancellationToken
Returns
Section titled “Returns”ValueTask<AgentSession>
RunCoreAsync(IEnumerable<ChatMessage>, AgentSession?, AgentRunOptions?, CancellationToken)
Section titled “ RunCoreAsync(IEnumerable<ChatMessage>, AgentSession?, AgentRunOptions?, CancellationToken)”protected override Task<AgentResponse> RunCoreAsync(IEnumerable<ChatMessage> messages, AgentSession? session = null, AgentRunOptions? options = null, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”messages IEnumerable<ChatMessage>
session AgentSession?
options AgentRunOptions?
cancellationToken CancellationToken
Returns
Section titled “Returns”Task<AgentResponse>
RunCoreStreamingAsync(IEnumerable<ChatMessage>, AgentSession?, AgentRunOptions?, CancellationToken)
Section titled “ RunCoreStreamingAsync(IEnumerable<ChatMessage>, AgentSession?, AgentRunOptions?, CancellationToken)”protected override IAsyncEnumerable<AgentResponseUpdate> RunCoreStreamingAsync(IEnumerable<ChatMessage> messages, AgentSession? session = null, AgentRunOptions? options = null, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”messages IEnumerable<ChatMessage>
session AgentSession?
options AgentRunOptions?
cancellationToken CancellationToken
Returns
Section titled “Returns”IAsyncEnumerable<AgentResponseUpdate>
SerializeSessionCoreAsync(AgentSession, JsonSerializerOptions?, CancellationToken)
Section titled “ SerializeSessionCoreAsync(AgentSession, JsonSerializerOptions?, CancellationToken)”protected override ValueTask<JsonElement> SerializeSessionCoreAsync(AgentSession session, JsonSerializerOptions? jsonSerializerOptions = null, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”session AgentSession
jsonSerializerOptions JsonSerializerOptions?
cancellationToken CancellationToken