Skip to main content
Control token estimation mode from the CLI — choose fast heuristics or accurate tiktoken counts when debugging context usage. The user runs CLI token estimation to preview context size before starting an expensive chat session.

How It Works

Quick Start

1

Run an agent with accurate token counts

Then check counts from the CLI:
2

Enable mismatch logging for debugging

Validated mode compares heuristic vs accurate estimates and logs when they diverge by more than 15%.

CLI Flags

Interactive Commands

config.yaml

Environment variables: PRAISONAI_CONTEXT_ESTIMATION_MODE, PRAISONAI_CONTEXT_LOG_MISMATCH.

Best Practices

Heuristic mode is fastest and sufficient for compaction triggers in normal use.
If compaction fires too early or too late, run with --context-estimation-mode accurate and check /context stats.
Enable validated + log-mismatch for a short session to calibrate heuristic accuracy for your model and prompt style.

Context Budgeter CLI

Allocate token budgets per segment

Context Management

Full context system overview