Skip to main content

ContextLedger

Defined in the models module.
AI Agent Tracks token usage across context segments. Provides per-segment token counts and total usage.

Properties

system_prompt
int
No description available.
rules
int
No description available.
skills
int
No description available.
memory
int
No description available.
tools_schema
int
No description available.
history
int
No description available.
tool_outputs
int
No description available.
buffer
int
No description available.
turn_count
int
No description available.
message_count
int
No description available.
tool_call_count
int
No description available.

Methods

total()

Total tokens across all segments.

get_segment()

Get token count for a segment.

set_segment()

Set token count for a segment.

add_segment()

Add tokens to a segment.
  • to_dict: Convert to dictionary.
  • copy: Create a copy of this ledger.

Source

View on GitHub

praisonaiagents/context/models.py at line 26

Context Concept

Context Management

Context Strategies