Skip to content

RunTreeCost

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

Total cost of a run tree (the root plus every child run).

public sealed record RunTreeCost : IEquatable<RunTreeCost>

objectRunTreeCost

IEquatable<RunTreeCost>

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

This must not be added to RunRecord.Cost: the value already includes the root’s own cost, for the same reason as RunRecord.TreeUsage. The user interface shows the two in separate columns.

public RunTreeCost()

Gets the total cached-input cost across the tree.

public decimal? CachedInputCost { get; init; }

decimal?

This is a THIRD addend of the tree’s total, not a subset of RunTreeCost.InputCost: every run’s own RunCost.InputCost already has its cached tokens subtracted out. A total that adds only input and output under-reports every tree that hit the prompt cache.

Gets the currency.

public string? Currency { get; init; }

string?

Gets the total input cost across the tree.

public decimal? InputCost { get; init; }

decimal?

Gets the total output cost across the tree.

public decimal? OutputCost { get; init; }

decimal?

Gets how many runs in the tree have an unknown price.

public long RunsWithUnknownPricing { get; init; }

long

public override bool Equals(object? obj)

obj object?

bool

public bool Equals(RunTreeCost? other)

other RunTreeCost?

bool

public override int GetHashCode()

int

public override string ToString()

string

Gets the tree’s total cost — input, output and cache read together.

public decimal? Total()

decimal?

null when no run in the tree was ever priced.

Same rule as RunCost.Total: never add only two of the three.

public static bool operator ==(RunTreeCost? left, RunTreeCost? right)

left RunTreeCost?

right RunTreeCost?

bool

public static bool operator !=(RunTreeCost? left, RunTreeCost? right)

left RunTreeCost?

right RunTreeCost?

bool