Class AgentToolNode.Builder
java.lang.Object
com.alibaba.cloud.ai.graph.agent.node.AgentToolNode.Builder
- Enclosing class:
- AgentToolNode
-
Method Summary
Modifier and TypeMethodDescriptionbuild()enableActingLog(boolean enableActingLog) maxParallelTools(int max) Set the maximum number of tools to execute in parallel.parallelToolExecution(boolean parallel) Enable parallel execution of multiple tool calls.toolCallbackResolver(org.springframework.ai.tool.resolution.ToolCallbackResolver toolCallbackResolver) toolCallbacks(List<org.springframework.ai.tool.ToolCallback> toolCallbacks) toolContext(Map<String, Object> toolContext) toolExecutionExceptionProcessor(org.springframework.ai.tool.execution.ToolExecutionExceptionProcessor toolExecutionExceptionProcessor) toolExecutionTimeout(Duration timeout) Set the timeout for each tool execution.wrapSyncToolsAsAsync(boolean wrap) Enable automatic wrapping of synchronous tools as async.
-
Method Details
-
agentName
-
enableActingLog
-
parallelToolExecution
Enable parallel execution of multiple tool calls. When enabled, tools will execute concurrently up tomaxParallelToolslimit.- Parameters:
parallel- true to enable parallel execution- Returns:
- this builder
-
maxParallelTools
Set the maximum number of tools to execute in parallel. This limits concurrent tool executions to prevent resource exhaustion.- Parameters:
max- the maximum parallel tools (default: 5)- Returns:
- this builder
- Throws:
IllegalArgumentException- if max is less than 1
-
toolExecutionTimeout
Set the timeout for each tool execution.- Parameters:
timeout- the timeout duration (default: 5 minutes)- Returns:
- this builder
-
wrapSyncToolsAsAsync
Enable automatic wrapping of synchronous tools as async.When enabled, synchronous tools (such as
@Toolannotated methods,FunctionToolCallback,MethodToolCallback, and MCP tools) are automatically wrapped usingAsyncToolCallbackAdapterto enable async execution. This allows all tools to benefit from the async execution infrastructure without requiring user code changes.This is especially useful when combined with
parallelToolExecution(boolean)to enable parallel execution of multiple tool calls.- Parameters:
wrap- true to enable automatic wrapping (default: false)- Returns:
- this builder
- See Also:
-
toolCallbacks
public AgentToolNode.Builder toolCallbacks(List<org.springframework.ai.tool.ToolCallback> toolCallbacks) -
toolCallbackResolver
public AgentToolNode.Builder toolCallbackResolver(org.springframework.ai.tool.resolution.ToolCallbackResolver toolCallbackResolver) -
toolContext
-
toolExecutionExceptionProcessor
public AgentToolNode.Builder toolExecutionExceptionProcessor(org.springframework.ai.tool.execution.ToolExecutionExceptionProcessor toolExecutionExceptionProcessor) -
build
-