Class LargeResultEvictionInterceptor.Builder
java.lang.Object
com.alibaba.cloud.ai.graph.agent.extension.interceptor.LargeResultEvictionInterceptor.Builder
- Enclosing class:
- LargeResultEvictionInterceptor
Builder for LargeResultEvictionInterceptor.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbackend(FilesystemBackend backend) Set custom backend for file storage operations.build()Convenience method to automatically exclude standard filesystem tools.excludeTool(String toolName) Add a single tool to the exclusion list.excludeTools(Set<String> excludedTools) Set tools to exclude from eviction.toolTokenLimitBeforeEvict(Integer toolTokenLimitBeforeEvict) Set token limit before evicting tool results to filesystem.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
toolTokenLimitBeforeEvict
public LargeResultEvictionInterceptor.Builder toolTokenLimitBeforeEvict(Integer toolTokenLimitBeforeEvict) Set token limit before evicting tool results to filesystem. When a tool result exceeds this limit (in tokens, approximated as chars/4), it will be automatically saved to /large_tool_results/ and the agent will receive a pointer to the file instead of the full content. Set to null to disable automatic eviction. Default: 20000 tokens Equivalent to Python's tool_token_limit_before_evict parameter. -
excludeTools
Set tools to exclude from eviction. These tools will never have their results evicted, even if they exceed the token limit. Useful for filesystem tools that already manage large content efficiently. Default: Empty set (no exclusions) Example:builder.excludeTools(Set.of("ls", "read_file", "write_file", "edit_file", "glob", "grep")); -
excludeTool
Add a single tool to the exclusion list. Convenience method for excluding tools one at a time.- Parameters:
toolName- Name of tool to exclude
-
backend
Set custom backend for file storage operations. The backend is used to write large results to persistent storage. NOTE: Backend implementation is optional. If not provided, eviction will still work by replacing the result text, but the full content won't be persisted to storage. -
excludeFilesystemTools
Convenience method to automatically exclude standard filesystem tools. Excludes: ls, read_file, write_file, edit_file, glob, grep -
build
-