UsageAccumulator class final

Mutable accumulator summing Usage across turns of an agent run.

Token fields are summed directly; Usage.reasoning and Usage.cacheWrite1h are optional per provider, so the accumulated total reports them as null until at least one added usage reported them. Costs are summed field by field.

Constructors

UsageAccumulator()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
total Usage
The accumulated totals as an immutable Usage.
no setter
turns int
Number of usages added so far (typically one per assistant turn).
no setter

Methods

add(Usage usage) → void
Adds one response's usage to the running totals.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited