Sycophant.Agent.Stats
(sycophant v0.4.2)
Copy Markdown
Tracks token usage and cost across agent turns.
Summary
Functions
Creates a new empty Stats.
Records a completed turn with usage data and finish reason.
Returns the number of recorded turns.
Returns turns in chronological order.
Types
@type t() :: %Sycophant.Agent.Stats{ total_cost: float(), total_input_tokens: non_neg_integer(), total_output_tokens: non_neg_integer(), total_reasoning_tokens: non_neg_integer(), turns: [Sycophant.Agent.Stats.Turn.t()] }
Functions
@spec new() :: t()
Creates a new empty Stats.
@spec record_turn(t(), Sycophant.Usage.t() | nil, atom()) :: t()
Records a completed turn with usage data and finish reason.
@spec turn_count(t()) :: non_neg_integer()
Returns the number of recorded turns.
@spec turns(t()) :: [Sycophant.Agent.Stats.Turn.t()]
Returns turns in chronological order.