AS AgentScopeAPI 手册 / API Reference

TruncateArgsConfig

public static class TruncateArgsConfig
源码Source io/agentscope/harness/agent/memory/compaction/CompactionConfig.java:424–515

Truncate 参数配置,保存相关配置项。位于 io.agentscope.harness.agent.memory.compaction 包。核心成员包括 getTriggerMessages、getTriggerTokens、getKeepMessages、getKeepTokens、getMaxArgLength、getTruncationText。

Configuration for the lightweight argument-truncation pass that runs before summarization.

When triggered, large string arguments of ToolUseBlocks in older messages (before the keep window) are clipped to #getMaxArgLength() characters. This is a cheap, non-LLM operation that prevents context ballooning from verbose tool invocations (e.g., write_file, edit_file).

Defaults (when enabled via Builder#truncateArgs(TruncateArgsConfig)):

  • Trigger at 25 messages or 40 000 tokens

  • Keep the 20 most recent messages untouched

  • Max argument length: 2 000 characters

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
TruncateArgsBuilder类class
Truncate 参数构建器,用于构建并配置目标实例。
A class in io.agentscope.harness.agent.memory.compaction that persists and restores session and memory data across calls.

方法摘要Method Summary

方法Method说明Description
public int getTriggerMessages()
获取 `getTriggerMessages`。
Returns the trigger messages.
public int getTriggerTokens()
获取 `getTriggerTokens`。
Returns the trigger tokens.
public int getKeepMessages()
获取 `getKeepMessages`。
Returns the keep messages.
public int getKeepTokens()
获取 `getKeepTokens`。
Returns the keep tokens.
public int getMaxArgLength()
获取 `getMaxArgLength`。
Maximum character length of any single tool argument value (default 2 000).
public String getTruncationText()
获取 `getTruncationText`。
Suffix appended after the first 20 characters of a truncated argument.
public static TruncateArgsBuilder builder()
static
返回构建器实例。
Returns the builder.

方法详情Method Detail

getTriggerMessages

public int getTriggerMessages()

获取 getTriggerMessages。

Returns the trigger messages.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/harness/agent/memory/compaction/CompactionConfig.java:442–444

getTriggerTokens

public int getTriggerTokens()

获取 getTriggerTokens。

Returns the trigger tokens.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/harness/agent/memory/compaction/CompactionConfig.java:446–448

getKeepMessages

public int getKeepMessages()

获取 getKeepMessages。

Returns the keep messages.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/harness/agent/memory/compaction/CompactionConfig.java:450–452

getKeepTokens

public int getKeepTokens()

获取 getKeepTokens。

Returns the keep tokens.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/harness/agent/memory/compaction/CompactionConfig.java:454–456

getMaxArgLength

public int getMaxArgLength()

获取 getMaxArgLength。

Maximum character length of any single tool argument value (default 2 000).

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/harness/agent/memory/compaction/CompactionConfig.java:459–461

getTruncationText

public String getTruncationText()

获取 getTruncationText。

Suffix appended after the first 20 characters of a truncated argument.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/memory/compaction/CompactionConfig.java:464–466

builder

public static TruncateArgsBuilder builder()
static

返回构建器实例。

Returns the builder.

返回Returns TruncateArgsBuilder
返回TruncateArgsBuilder。Returns truncate args builder.
源码Source io/agentscope/harness/agent/memory/compaction/CompactionConfig.java:468–470

嵌套类详情Nested Class Detail

TruncateArgsBuilder

public static class TruncateArgsBuilder

Truncate 参数构建器,用于构建并配置目标实例。位于 io.agentscope.harness.agent.memory.compaction 包。核心成员包括 triggerMessages、triggerTokens、keepMessages、keepTokens、maxArgLength、truncationText。

A class in io.agentscope.harness.agent.memory.compaction that persists and restores session and memory data across calls. Declared in io.agentscope.harness.agent.memory.compaction.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.