Package com.tnsai.agents.execution
Interface ToolCallAction
- All Known Implementing Classes:
ToolCallAction.Allow,ToolCallAction.Block,ToolCallAction.Fallback,ToolCallAction.Guide
public sealed interface ToolCallAction
permits ToolCallAction.Allow, ToolCallAction.Block, ToolCallAction.Guide, ToolCallAction.Fallback
Represents the outcome of a
ToolCallFilter evaluation.
Four possible actions:
allow()— proceed with tool executionblock()— reject the tool callguide(String)— don't execute yet, feed guidance back to the agent so it can self-correct and retryfallback(String)— suggest an alternative tool or approach
Inspired by Strands Agents' SteeringHandler pattern.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordAllow the tool call to proceed as-is.static final recordBlock the tool call entirely.static final recordDon't execute; suggest an alternative tool or approach.static final recordDon't execute; provide feedback for the agent to self-correct. -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolCallActionallow()Creates an action that allows the tool call to proceed.static ToolCallActionblock()Creates an action that blocks the tool call.static ToolCallActionCreates an action that suggests an alternative tool or approach.static ToolCallActionCreates an action that provides guidance to the agent for self-correction.default booleanWhether the tool call should proceed immediately.
-
Method Details
-
shouldProceed
default boolean shouldProceed()Whether the tool call should proceed immediately. -
allow
Creates an action that allows the tool call to proceed. -
block
Creates an action that blocks the tool call. -
guide
Creates an action that provides guidance to the agent for self-correction. The tool call is not executed; instead the feedback is injected into the agent's context so it can adjust parameters and retry.- Parameters:
feedback- correction guidance for the agent
-
fallback
Creates an action that suggests an alternative tool or approach. The original tool call is not executed.- Parameters:
suggestion- alternative tool name or approach description
-