ToolApprovalAgentDecorator
AgentPrism.Core.dllWraps every agent resolved from the catalog with Microsoft Agent Framework’s
AI.ToolApprovalAgent decorator and supplies persistent “do not ask again”
rules as automatic approval rules.
public sealed class ToolApprovalAgentDecorator : IAgentDecoratorInheritance
Section titled “Inheritance”object ← ToolApprovalAgentDecorator
Implements
Section titled “Implements”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”ToolApprovalAgentDecorator.Order is 20, which makes this the innermost of three decorators. Approval must occur at the layer closest to the model call. If it occurred outside, telemetry and run recording would include approval waiting time in their duration.
This class does not decide which tool needs approval.
ToolRegistry makes that decision. It wraps an approval-required tool
in ApprovalRequiredAIFunction, causing MAF to produce
ToolApprovalRequestContent instead of running the call. This class only
applies automatic approval rules.
Constructors
Section titled “Constructors”ToolApprovalAgentDecorator(ToolApprovalRuleEvaluator)
Section titled “ ToolApprovalAgentDecorator(ToolApprovalRuleEvaluator)”Initializes a new approval decorator.
public ToolApprovalAgentDecorator(ToolApprovalRuleEvaluator evaluator)Parameters
Section titled “Parameters”evaluator ToolApprovalRuleEvaluator
The evaluator that applies persistent rules.
Exceptions
Section titled “Exceptions”evaluator is null.
Properties
Section titled “Properties”Gets the order of application. A lower value wraps inside, a higher value wraps outside. Run recording uses 0, which makes it the outermost decorator.
public int Order { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Decorate(AIAgent, AgentDescriptor)
Section titled “ Decorate(AIAgent, AgentDescriptor)”Decorates the agent.
public AIAgent Decorate(AIAgent agent, AgentDescriptor descriptor)Parameters
Section titled “Parameters”agent AIAgent
The agent to decorate.
descriptor AgentDescriptor
The catalog summary of the agent.
Returns
Section titled “Returns”AIAgent
The decorated agent.