Class ToolInterceptor
java.lang.Object
com.alibaba.cloud.ai.graph.agent.interceptor.ToolInterceptor
- All Implemented Interfaces:
Interceptor
- Direct Known Subclasses:
LargeResultEvictionInterceptor,ToolEmulatorInterceptor,ToolErrorInterceptor,ToolRetryInterceptor
Tool interceptor that can wrap tool calls.
Implementations can modify requests, responses, or add behavior like retry, caching, etc.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ToolCallResponseinterceptToolCall(ToolCallRequest request, ToolCallHandler handler) Wrap a tool call with custom logic.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.alibaba.cloud.ai.graph.agent.interceptor.Interceptor
getName
-
Constructor Details
-
ToolInterceptor
public ToolInterceptor()
-
-
Method Details
-
interceptToolCall
public abstract ToolCallResponse interceptToolCall(ToolCallRequest request, ToolCallHandler handler) Wrap 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.- Parameters:
request- The tool call requesthandler- The next handler in the chain (or base handler)- Returns:
- The tool call response
-