pub struct AgentCost {
pub standing_context: usize,
pub input: usize,
pub output: usize,
pub retries: usize,
}Expand description
The four token-cost terms an agent pays per task. All in tokens.
Fields§
§standing_context: usizeSchema/cheatsheet the model must carry to use the program (re-sent/turn).
input: usizeWhat the agent writes — the program text itself.
output: usizeWhat the agent reads back — a representative output sample.
retries: usizeEstimated re-do cost from ambiguity/parse failure (caller-supplied; 0 if the program is unambiguous).
Implementations§
Source§impl AgentCost
impl AgentCost
Sourcepub fn total_over(&self, turns: usize) -> usize
pub fn total_over(&self, turns: usize) -> usize
Total tokens over turns, the §4 criterion: the standing context is paid
once (amortized), input+output are paid each turn, and retries are added.
turns = 1 gives the single-shot cost.
Sourcepub fn total_standing_per_turn(&self, turns: usize) -> usize
pub fn total_standing_per_turn(&self, turns: usize) -> usize
Total tokens over turns in the no-prompt-caching model: the standing
context is re-sent every turn (the worst case for a representation with a
heavy schema/cheatsheet). total_over is the
caching-aware default (standing context paid once); this is the upper bound.