Skip to content

ContentGuardResult

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

The result of an IContentGuard check.

public sealed record ContentGuardResult : IEquatable<ContentGuardResult>

objectContentGuardResult

IEquatable<ContentGuardResult>

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

The result does not carry the blocked content. It only carries the matched rule’s name and the block reason; both are written to the audit trail and the run event. Blocked content is sensitive by definition, and writing it into an audit trail makes the problem permanent.

public ContentGuardResult()

The decision made.

public required ContentGuardAction Action { get; init; }

ContentGuardAction

The content passes unchanged.

public static ContentGuardResult Allow { get; }

ContentGuardResult

A single instance is shared: this is the value guards return most often, and it must not allocate on the hot path.

The new text to send to the model (or return to the client). Populated only for ContentGuardAction.Mask.

public string? MaskedText { get; init; }

string?

The block reason. Does not carry the blocked TEXT.

public string? Reason { get; init; }

string?

The matched rule’s name. Does not carry the matched CONTENT.

public string? RuleName { get; init; }

string?

The content is blocked; the run becomes Failed.

public static ContentGuardResult Block(string ruleName, string reason)

ruleName string

The matched rule’s name.

reason string

The block reason. MUST not carry the blocked text.

ContentGuardResult

A block decision.

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(ContentGuardResult? other)

other ContentGuardResult?

bool

public override int GetHashCode()

int

The content passes after being modified.

public static ContentGuardResult Mask(string maskedText, string ruleName)

maskedText string

The new form of the content.

ruleName string

The matched rule’s name.

ContentGuardResult

A mask decision.

public override string ToString()

string

operator ==(ContentGuardResult?, ContentGuardResult?)

Section titled “ operator ==(ContentGuardResult?, ContentGuardResult?)”
public static bool operator ==(ContentGuardResult? left, ContentGuardResult? right)

left ContentGuardResult?

right ContentGuardResult?

bool

operator !=(ContentGuardResult?, ContentGuardResult?)

Section titled “ operator !=(ContentGuardResult?, ContentGuardResult?)”
public static bool operator !=(ContentGuardResult? left, ContentGuardResult? right)

left ContentGuardResult?

right ContentGuardResult?

bool