Skip to content

RunRecordingAgentDecorator

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Wraps every agent resolved from the catalog with RunRecordingAgent.

public sealed class RunRecordingAgentDecorator : IAgentDecorator

objectRunRecordingAgentDecorator

IAgentDecorator

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

RunRecordingAgentDecorator.Order is 0, so run recording is the outermost wrapper and also measures the time spent by inner wrappers.

RunRecordingAgentDecorator(IRunStore, ITenantContext, IOptions<AgentPrismOptions>, ILogger<RunRecordingAgent>, AgentPrismMetrics?, RunTraceCollector?, TimeProvider?, IRunPricingResolver?, QuotaEnforcer?, IWebhookPublisher?, IRunCancellationRegistry?, IRunErrorClassifier?, IRunInputStore?, RunSampler?, ContentGuardPipeline?, IRunAttributionContext?, IEnumerable<IRunEventSink>?)

Section titled “ RunRecordingAgentDecorator(IRunStore, ITenantContext, IOptions<AgentPrismOptions>, ILogger<RunRecordingAgent>, AgentPrismMetrics?, RunTraceCollector?, TimeProvider?, IRunPricingResolver?, QuotaEnforcer?, IWebhookPublisher?, IRunCancellationRegistry?, IRunErrorClassifier?, IRunInputStore?, RunSampler?, ContentGuardPipeline?, IRunAttributionContext?, IEnumerable<IRunEventSink>?)”

Creates a new recording decorator.

public RunRecordingAgentDecorator(IRunStore runStore, ITenantContext tenantContext, IOptions<AgentPrismOptions> options, ILogger<RunRecordingAgent> logger, AgentPrismMetrics? metrics = null, RunTraceCollector? traceCollector = null, TimeProvider? timeProvider = null, IRunPricingResolver? pricingResolver = null, QuotaEnforcer? quotaEnforcer = null, IWebhookPublisher? webhookPublisher = null, IRunCancellationRegistry? cancellationRegistry = null, IRunErrorClassifier? errorClassifier = null, IRunInputStore? runInputStore = null, RunSampler? runSampler = null, ContentGuardPipeline? contentGuardPipeline = null, IRunAttributionContext? attributionContext = null, IEnumerable<IRunEventSink>? sinks = null)

runStore IRunStore

The store the events are written to.

tenantContext ITenantContext

The tenant context.

options IOptions<AgentPrismOptions>

The AgentPrism settings.

logger ILogger<RunRecordingAgent>

The logger.

metrics AgentPrismMetrics?

The metric instruments.

traceCollector RunTraceCollector?

The span collector.

timeProvider TimeProvider?

The time source.

pricingResolver IRunPricingResolver?

The cost resolver. If null, cost is not computed.

quotaEnforcer QuotaEnforcer?

The quota accountant. If null, consumption is not counted.

webhookPublisher IWebhookPublisher?

The event publisher. If null, no events are published.

cancellationRegistry IRunCancellationRegistry?

The cancellation registry. If null, the run cannot be canceled from outside.

errorClassifier IRunErrorClassifier?

The error classifier. If null, no error class/fingerprint is computed.

runInputStore IRunInputStore?

The input store. If null, input is not recorded and replay does not work.

runSampler RunSampler?

The online evaluation sampler. If null, no run is sampled.

contentGuardPipeline ContentGuardPipeline?

The content guard pipeline. If null, recorded input is written without inspection. See the note in the RunRecordingAgent constructor.

attributionContext IRunAttributionContext?

The attribution context. If null, the run records no user and no labels.

sinks IEnumerable<IRunEventSink>?

The run event observers. If null or empty, every event goes to runStore only.

ArgumentNullException

One of the required dependencies 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.