ToolResultEvictionConfig
public class ToolResultEvictionConfig
io/agentscope/harness/agent/memory/compaction/ToolResultEvictionConfig.java:43–152工具结果淘汰配置,保存相关配置项。位于 io.agentscope.harness.agent.memory.compaction 包。核心成员包括 defaults、getMaxResultChars、getPreviewChars、getEvictionPath、getExcludedToolNames、builder。
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 io.agentscope.core.message.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.
Both operate independently on different trigger conditions and different lifecycle events.
-
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(relative to the workspace) -
Excluded tools: filesystem read/write/edit + memory tools (small or self-paginating)
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
Builder | 类class | `ToolResultEvictionConfig`的构建器。 Builder for `ToolResultEvictionConfig`. |
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
DEFAULT_MAX_RESULT_CHARSstaticfinal | int | 默认最大结果字符数字段。 ~20 K tokens × 4 chars/token — default eviction threshold. |
DEFAULT_PREVIEW_CHARSstaticfinal | int | 默认预览字符数字段。 Characters to show at head and tail in the eviction placeholder preview. |
DEFAULT_EVICTION_PATHstaticfinal | String | 默认淘汰路径字段。 Workspace-relative path prefix under which evicted results are stored. |
DEFAULT_EXCLUDED_TOOLSstaticfinal | Set<String> | 默认 EXCLUDED 工具字段。 Tools excluded from eviction by default. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public static ToolResultEvictionConfig defaults()static | 返回 `defaults` 结果。 Creates a config with all defaults applied. |
public int getMaxResultChars() | 获取最大结果字符数。 Maximum text length (chars) before eviction fires. |
public int getPreviewChars() | 获取预览字符数。 Characters to show in the head and tail preview. |
public String getEvictionPath() | 获取淘汰路径。 Root path under which evicted files are written (e.g. |
public Set<String> getExcludedToolNames() | 获取 `getExcludedToolNames`。 Tool names that will never be evicted regardless of result size. |
public static Builder builder()static | 返回构建器实例。 Returns the builder. |
字段详情Field Detail
DEFAULT_MAX_RESULT_CHARS
public static final int DEFAULT_MAX_RESULT_CHARS
默认最大结果字符数字段。声明为 public static final int DEFAULT_MAX_RESULT_CHARS。
~20 K tokens × 4 chars/token — default eviction threshold.
io/agentscope/harness/agent/memory/compaction/ToolResultEvictionConfig.java:46DEFAULT_PREVIEW_CHARS
public static final int DEFAULT_PREVIEW_CHARS
默认预览字符数字段。声明为 public static final int DEFAULT_PREVIEW_CHARS。
Characters to show at head and tail in the eviction placeholder preview.
io/agentscope/harness/agent/memory/compaction/ToolResultEvictionConfig.java:49DEFAULT_EVICTION_PATH
public static final String DEFAULT_EVICTION_PATH
默认淘汰路径字段。声明为 public static final String DEFAULT_EVICTION_PATH。
Workspace-relative path prefix under which evicted results are stored.
io/agentscope/harness/agent/memory/compaction/ToolResultEvictionConfig.java:52DEFAULT_EXCLUDED_TOOLS
public static final Set<String> DEFAULT_EXCLUDED_TOOLS
默认 EXCLUDED 工具字段。声明为 public static final Set DEFAULT_EXCLUDED_TOOLS。
Tools excluded from eviction by default.
io/agentscope/harness/agent/memory/compaction/ToolResultEvictionConfig.java:66–73方法详情Method Detail
defaults
public static ToolResultEvictionConfig defaults()
返回 defaults 结果。
Creates a config with all defaults applied.
ToolResultEvictionConfigio/agentscope/harness/agent/memory/compaction/ToolResultEvictionConfig.java:88–90getMaxResultChars
public int getMaxResultChars()
获取最大结果字符数。
Maximum text length (chars) before eviction fires.
intio/agentscope/harness/agent/memory/compaction/ToolResultEvictionConfig.java:93–95getPreviewChars
public int getPreviewChars()
获取预览字符数。
Characters to show in the head and tail preview.
intio/agentscope/harness/agent/memory/compaction/ToolResultEvictionConfig.java:98–100getEvictionPath
public String getEvictionPath()
获取淘汰路径。
Root path under which evicted files are written (e.g.
Stringio/agentscope/harness/agent/memory/compaction/ToolResultEvictionConfig.java:103–105getExcludedToolNames
public Set<String> getExcludedToolNames()
获取 getExcludedToolNames。
Tool names that will never be evicted regardless of result size.
Set<String>io/agentscope/harness/agent/memory/compaction/ToolResultEvictionConfig.java:108–110builder
public static Builder builder()
返回构建器实例。
Returns the builder.
Builderio/agentscope/harness/agent/memory/compaction/ToolResultEvictionConfig.java:112–114嵌套类详情Nested Class Detail
Builder
public static class BuilderToolResultEvictionConfig的构建器。位于 io.agentscope.harness.agent.memory.compaction 包。核心成员包括 maxResultChars、previewChars、evictionPath、excludedToolNames、build。
Builder for ToolResultEvictionConfig.