Skip to content

Latest commit

 

History

History

context

README.md

Context Examples

Examples demonstrating context tree inspection with sampling strategies and context shrinking using the Compactor protocol. For a conceptual overview of compaction, see Context and Sessions.

Examples

File Description
contexts_with_sampling.py Inspecting per-attempt generation contexts, validation contexts, and context tree navigation in sampling results.
window_compactor.py Sliding window compaction with system-prefix pinning and custom pin predicates.
threshold_compactor.py Gating window compaction on cumulative conversation token thresholds.
custom_compactor.py Implementing custom Compactor protocols via class implementations and manual invocation.
react_compaction.py Composing ReACT agent loops with per-add and per-turn context compaction strategies.