Skip to content

AgentRunScope

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Represents the view of a running run that is exposed to the helper components in the run path.

public sealed record AgentRunScope : IEquatable<AgentRunScope>

objectAgentRunScope

IEquatable<AgentRunScope>

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

The scope is opened by RunRecordingAgent. A sub-agent invocation builds its own AgentPrismRunOptions object from the values it reads here; this is how tree linkage, depth, and budget are carried through the call chain.

public AgentRunScope()

Gets the name of the agent running this run.

public string? AgentName { get; init; }

string?

Gets the definition version this run measures. null if unknown.

public int? AgentVersion { get; init; }

int?

Gets the budget shared across the tree.

public AgentRunBudget? Budget { get; init; }

AgentRunBudget?

Gets the depth in the tree. The root run is 0.

public int Depth { get; init; }

int

Gets the identity of the experiment this run belongs to. null for a run outside an experiment.

public Guid? ExperimentId { get; init; }

Guid?

Gets the identity of the run at the root of the tree. Equal to AgentRunScope.RunId at the root.

public required Guid RootRunId { get; init; }

Guid

Gets the identity of the running run.

public required Guid RunId { get; init; }

Guid

Gets the session the run belongs to. null for a sessionless run.

public string? SessionId { get; init; }

string?

Content that a tool produces and writes to the attachments table MUST CARRY this field. The retention policy treats an attachment with an empty session_id field as orphaned and deletes it after the cutoff date; the content in the transcript is then lost while the session is still alive. A tool cannot access AgentSession, so this is the only place it can read the session identity from.

Gets the tenant of the run. A sub-run cannot leave this tenant.

public string? TenantId { get; init; }

string?

Gets the name of the experiment arm this run is assigned to. null for a run outside an experiment.

public string? Variant { get; init; }

string?

Gets the event writer for this run. A sub-run writes its summary events here.

public RunEventWriter? Writer { get; init; }

RunEventWriter?

The sequence number is produced by a single writer. If a sub-call set up its own writer, the same run would end up with two independent counters and the sequence numbers would collide.

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(AgentRunScope? other)

other AgentRunScope?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(AgentRunScope?, AgentRunScope?)

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

left AgentRunScope?

right AgentRunScope?

bool

operator !=(AgentRunScope?, AgentRunScope?)

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

left AgentRunScope?

right AgentRunScope?

bool