Skip to content

ToolApprovalAgentDecorator

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Wraps 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 : IAgentDecorator

objectToolApprovalAgentDecorator

IAgentDecorator

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

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.

ToolApprovalAgentDecorator(ToolApprovalRuleEvaluator)

Section titled “ ToolApprovalAgentDecorator(ToolApprovalRuleEvaluator)”

Initializes a new approval decorator.

public ToolApprovalAgentDecorator(ToolApprovalRuleEvaluator evaluator)

evaluator ToolApprovalRuleEvaluator

The evaluator that applies persistent rules.

ArgumentNullException

evaluator is null.

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; }

int

Decorates the agent.

public AIAgent Decorate(AIAgent agent, AgentDescriptor descriptor)

agent AIAgent

The agent to decorate.

descriptor AgentDescriptor

The catalog summary of the agent.

AIAgent

The decorated agent.