Skip to content

RunCompletion

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

Everything needed to close a run.

public sealed record RunCompletion : IEquatable<RunCompletion>

objectRunCompletion

IEquatable<RunCompletion>

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

public RunCompletion()

Gets the completion time (UTC).

public required DateTimeOffset CompletedAt { get; init; }

DateTimeOffset

Gets the computed cost. null when the model is unknown (a code agent, for example); when the model is known the value is populated even if the price is not (see RunCost).

public RunCost? Cost { get; init; }

RunCost?

Gets the error information. Only populated for RunStatus.Failed.

public RunError? Error { get; init; }

RunError?

Gets the total number of events written.

public long EventCount { get; init; }

long

Gets the model that actually answered, overriding runs.model_id when it differs from the value written at RunStarted. null leaves the stored value unchanged.

public string? ModelId { get; init; }

string?

The row is written once, at run start, from the agent’s primary ModelBinding — before it is known whether a ModelBinding.Fallbacks link will answer instead. This field lets completion correct the record so IRunStore.GetStatisticsAsync’s ByModel breakdown groups by the model that really ran. null is the overwhelmingly common case (no fallback happened) and is a deliberate no-op, not an omission.

Gets the run id.

public required Guid RunId { get; init; }

Guid

Gets the final status.

public required RunStatus Status { get; init; }

RunStatus

Gets the EXPECTED tenant of the run being closed. Defence in depth; when null no tenant check is made.

[JsonIgnore]
public string? TenantId { get; init; }

string?

For the reason, and why the ambient tenant is not used, see RunEvent.TenantId.

The field is WRITE-side only and is removed from the transport contract with Serialization.JsonIgnoreAttribute.

Gets the token usage.

public RunUsage? Usage { get; init; }

RunUsage?

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(RunCompletion? other)

other RunCompletion?

bool

public override int GetHashCode()

int

public override string ToString()

string

operator ==(RunCompletion?, RunCompletion?)

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

left RunCompletion?

right RunCompletion?

bool

operator !=(RunCompletion?, RunCompletion?)

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

left RunCompletion?

right RunCompletion?

bool