class

Anthropic::CompactionConfig

Inherits Reference < Object

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

enabled(threshold : Int32 = 10000, &on_compact : Int32, Int32 -> Nil) : self

Create enabled compaction config with callback

Source
new(enabled : Bool = false, context_token_threshold : Int32 = 10000, on_compact : Proc(Int32, Int32, Nil) | Nil = nil)
Source

Instance methods

context_token_threshold
Source
context_token_threshold=(context_token_threshold : Int32)
Source
enabled=(enabled : Bool)
Source
enabled?
Source
on_compact
Source
on_compact=(on_compact : Proc(Int32, Int32, Nil) | Nil)
Source