Class CompactionConfig.Builder
java.lang.Object
io.agentscope.harness.agent.memory.compaction.CompactionConfig.Builder
- Enclosing class:
- CompactionConfig
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()flushBeforeCompact(boolean flushBeforeCompact) Whether to flush long-term memories before compaction (default true).keepMessages(int keepMessages) Number of recent messages to keep verbatim after compaction.keepTokens(int keepTokens) Token budget for the preserved tail.keepTokensMax(int keepTokensMax) keepTokensMin(int keepTokensMin) keepTokensRatio(double keepTokensRatio) model(io.agentscope.core.model.Model model) Sets a dedicated model for compaction (summarization), allowing a lighter/cheaper model than the agent's primary reasoning model.Sets a dedicated model for compaction by model id string (e.g.offloadBeforeCompact(boolean offloadBeforeCompact) Whether to offload raw messages to session JSONL before compaction (default true).prune(CompactionConfig.PruneConfig config) Configures aggregate tool-result pruning.reserved(int reserved) Token buffer reserved for the compaction process (default 20 000).summaryPrompt(String summaryPrompt) Custom summary prompt.triggerMessages(int triggerMessages) Trigger compaction when conversation has at least this many messages (0 = disabled).triggerTokens(int triggerTokens) Trigger compaction when estimated token count exceeds this value.Enables lightweight pre-summarization argument truncation.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
triggerMessages
Trigger compaction when conversation has at least this many messages (0 = disabled). -
triggerTokens
Trigger compaction when estimated token count exceeds this value.0(default) = dynamic mode: compute from model's context window minusreserved(int). -
reserved
Token buffer reserved for the compaction process (default 20 000). Only used in dynamic mode (triggerTokens == 0). -
keepMessages
Number of recent messages to keep verbatim after compaction. -
keepTokens
Token budget for the preserved tail.-1(default) = dynamic mode;0= use keepMessages;> 0= static. -
keepTokensMin
-
keepTokensMax
-
keepTokensRatio
-
summaryPrompt
Custom summary prompt. Must contain{messages}placeholder. -
flushBeforeCompact
Whether to flush long-term memories before compaction (default true). -
offloadBeforeCompact
Whether to offload raw messages to session JSONL before compaction (default true). -
truncateArgs
Enables lightweight pre-summarization argument truncation. Passnullto disable. -
prune
Configures aggregate tool-result pruning. Defaults toCompactionConfig.PruneConfig.defaults(). Passnullto disable. -
model
Sets a dedicated model for compaction (summarization), allowing a lighter/cheaper model than the agent's primary reasoning model. -
model
Sets a dedicated model for compaction by model id string (e.g."openai:gpt-4.1-mini").- See Also:
-
ModelRegistry.resolve(String)
-
build
-