Expand description
Token, cost, and session-usage types shared across the workspace.
These are wire types. Agent crates produce them and protocol crates serialize them, so they live here as the lowest common dependency. Keep this module small: behavior belongs with the agents that produce the values.
Structs§
- Context
Usage - One agent’s context window after its most recent LLM call.
- Model
Identity - Provider, model id, and catalog pricing of the model serving a call. All
fields are
Nonefor dynamic or local models the catalog does not know. - Model
Pricing - Provider/model prices sourced from models.dev, denominated in USD per million tokens.
- Session
Usage Event - One provider usage sample, its estimated cost, and the totals after it.
- Session
Usage Totals - Running token totals and cost estimate across every call an agent has seen.
- Token
Usage - Token counts for a single LLM call or an aggregate of calls. Providers fill
in only the dimensions they report; the rest stay
None. - Tokens
- A count of tokens. Sums saturate instead of wrapping.
- Usage
Cost - Estimated USD cost of one call, split by token pool.
- Usage
Source - The agent a usage sample belongs to and where it sits in the sub-agent
tree. A freshly created source has no parent; the agent that receives a
sub-agent’s usage fills in
parent_agent_idandtask_id. - Usd
- A monetary amount denominated in US dollars.
Enums§
- LlmCall
Purpose - What an LLM call was issued for.