.NET API
ContentGuardContext
Tracon.Abstractions.dllThe context of an IContentGuard call.
public sealed record ContentGuardContext : IEquatable<ContentGuardContext>Inheritance
Section titled “Inheritance”Implements
Section titled “Implements”IEquatable<ContentGuardContext>
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”The context carries a single piece of text, not a message
list. If messages were concatenated into one text, a false pattern could
match at the boundary between two messages (example: if one message ends
with 4539 and the next starts with 5787…, an invalid card
number would “be found”).
Constructors
Section titled “Constructors”ContentGuardContext()
Section titled “ ContentGuardContext()”public ContentGuardContext()Properties
Section titled “Properties”AgentName
Section titled “ AgentName”The name of the agent executing the run. null if unknown.
public string? AgentName { get; init; }Property Value
Section titled “Property Value”Direction
Section titled “ Direction”The direction of the check.
public required ContentGuardDirection Direction { get; init; }Property Value
Section titled “Property Value”ModelId
Section titled “ ModelId”The identifier of the model being called. null if unknown.
public string? ModelId { get; init; }Property Value
Section titled “Property Value”The run identifier. null if called outside a run’s scope.
public Guid? RunId { get; init; }Property Value
Section titled “Property Value”Guid?
Source
Section titled “ Source”The source of the inspected text.
public ContentGuardSource Source { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”Defaults to ContentGuardSource.Unknown — code built before this field existed leaves it at that value, and that is deliberate: a guard must treat an unclassified source as at least as sensitive as a tool result, never as an implicit “allow”.
TenantId
Section titled “ TenantId”The run’s tenant. null if unknown.
public string? TenantId { get; init; }Property Value
Section titled “Property Value”The text to check.
public required string Text { get; init; }Property Value
Section titled “Property Value”ToolName
Section titled “ ToolName”The name of the tool whose result is being inspected. null when ContentGuardContext.Source is not ContentGuardSource.ToolResult.
public string? ToolName { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”Can also be null while ContentGuardContext.Source is
still ContentGuardSource.ToolResult: resolving the
name requires the matching FunctionCallContent to still be present
earlier in the same message list, and a many-turn conversation can have
dropped it. A security decision must key off ContentGuardContext.Source, never
off this field’s presence.
Methods
Section titled “Methods”Equals(object?)
Section titled “ Equals(object?)”public override bool Equals(object? obj)Parameters
Section titled “Parameters”obj object?
Returns
Section titled “Returns”Equals(ContentGuardContext?)
Section titled “ Equals(ContentGuardContext?)”public bool Equals(ContentGuardContext? other)Parameters
Section titled “Parameters”other ContentGuardContext?
Returns
Section titled “Returns”GetHashCode()
Section titled “ GetHashCode()”public override int GetHashCode()Returns
Section titled “Returns”ToString()
Section titled “ ToString()”public override string ToString()Returns
Section titled “Returns”Operators
Section titled “Operators”operator ==(ContentGuardContext?, ContentGuardContext?)
Section titled “ operator ==(ContentGuardContext?, ContentGuardContext?)”public static bool operator ==(ContentGuardContext? left, ContentGuardContext? right)Parameters
Section titled “Parameters”left ContentGuardContext?
right ContentGuardContext?
Returns
Section titled “Returns”operator !=(ContentGuardContext?, ContentGuardContext?)
Section titled “ operator !=(ContentGuardContext?, ContentGuardContext?)”public static bool operator !=(ContentGuardContext? left, ContentGuardContext? right)Parameters
Section titled “Parameters”left ContentGuardContext?
right ContentGuardContext?