Class ToolResultEvictionConfig
java.lang.Object
io.agentscope.harness.agent.memory.compaction.ToolResultEvictionConfig
Configuration for per-tool-result eviction of oversized outputs.
When a tool produces a result whose text content exceeds getMaxResultChars(), the
full output is written to the workspace filesystem abstraction at a deterministic path under
getEvictionPath(), and the in-context ToolResultBlock
is replaced with a compact placeholder that includes a head+tail preview and an instruction to
use readFile for the full content.
This mechanism is orthogonal to conversation summarization (CompactionConfig):
- Eviction addresses context width — individual messages that are too large.
- Compaction addresses context depth — too many accumulated messages.
- Trigger at 80,000 characters (~20 K tokens at 4 chars/token)
- Preview: first + last 2,000 characters of the original output
- Eviction path prefix:
/large_tool_results - Excluded tools: filesystem read/write/edit/list + memory tools (small or self-paginating)
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringRoot path prefix under which evicted results are stored.Tools excluded from eviction by default.static final int~20 K tokens × 4 chars/token — default eviction threshold.static final intCharacters to show at head and tail in the eviction placeholder preview. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()static ToolResultEvictionConfigdefaults()Creates a config with all defaults applied.Root path under which evicted files are written (e.g.Tool names that will never be evicted regardless of result size.intMaximum text length (chars) before eviction fires.intCharacters to show in the head and tail preview.
-
Field Details
-
DEFAULT_MAX_RESULT_CHARS
public static final int DEFAULT_MAX_RESULT_CHARS~20 K tokens × 4 chars/token — default eviction threshold.- See Also:
-
DEFAULT_PREVIEW_CHARS
public static final int DEFAULT_PREVIEW_CHARSCharacters to show at head and tail in the eviction placeholder preview.- See Also:
-
DEFAULT_EVICTION_PATH
Root path prefix under which evicted results are stored.- See Also:
-
DEFAULT_EXCLUDED_TOOLS
Tools excluded from eviction by default.read_file— evicting would cause re-read loops; pagination handles sizewrite_file,edit_file— return tiny success messagesgrep_files,glob_files,list_files— self-limiting outputsmemory_search,memory_get,session_search— small/paginated results
execute) is intentionally NOT excluded: command output can be very large.
-
-
Method Details
-
defaults
Creates a config with all defaults applied. -
getMaxResultChars
public int getMaxResultChars()Maximum text length (chars) before eviction fires. -
getPreviewChars
public int getPreviewChars()Characters to show in the head and tail preview. -
getEvictionPath
Root path under which evicted files are written (e.g./large_tool_results). -
getExcludedToolNames
Tool names that will never be evicted regardless of result size. -
builder
-