Anthropic::CompactionConfig
Configuration for automatic message compaction
When enabled, the tool runner will automatically compress conversation history when token usage exceeds the specified threshold.
compaction = Anthropic::CompactionConfig.new(
enabled: true,
context_token_threshold: 3000,
on_compact: ->(before : Int32, after : Int32) {
puts "Compacted: #{before} -> #{after} tokens"
}
)
Constructors
Create enabled compaction config with callback
Instance methods
context_token_threshold
Sourceenabled?
Sourceon_compact
Source