Class ToolRetryInterceptor
java.lang.Object
com.alibaba.cloud.ai.graph.agent.interceptor.ToolInterceptor
com.alibaba.cloud.ai.graph.agent.interceptor.toolretry.ToolRetryInterceptor
- All Implemented Interfaces:
Interceptor
Tool interceptor that automatically retries failed tool calls with configurable backoff.
Supports retrying on specific exceptions and exponential backoff.
Example:
ToolRetryInterceptor interceptor = ToolRetryInterceptor.builder()
.maxRetries(3)
.backoffFactor(2.0)
.initialDelay(1000)
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enum -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolRetryInterceptor.Builderbuilder()getName()interceptToolCall(ToolCallRequest request, ToolCallHandler handler) Wrap a tool call with custom logic.
-
Method Details
-
builder
-
interceptToolCall
Description copied from class:ToolInterceptorWrap a tool call with custom logic. Implementations can: - Modify the request before calling the handler - Call the handler multiple times (retry logic) - Modify the response after handler returns - Add caching, logging, monitoring, etc.- Specified by:
interceptToolCallin classToolInterceptor- Parameters:
request- The tool call requesthandler- The next handler in the chain (or base handler)- Returns:
- The tool call response
-
getName
-