Skip to main content

ContextLedger

Defined in the context module.
Rust AI Agent SDK Tracks token usage across different context segments.

Fields

Methods

new

Create a new ledger with max tokens Parameters:

add

Add a segment to the ledger Parameters:

remaining

Get remaining tokens

is_over_budget

Check if over budget

utilization

Get utilization percentage

Source

View on GitHub

praisonai/src/context/mod.rs at line 95

Rust Context Management

Rust Token Management