Module agentforge4j.runtime
Package com.agentforge4j.runtime.tool
Class ToolInvocationCommandHandler
java.lang.Object
com.agentforge4j.runtime.tool.ToolInvocationCommandHandler
- All Implemented Interfaces:
CommandHandler<ToolInvocationCommand>
public final class ToolInvocationCommandHandler
extends Object
implements CommandHandler<ToolInvocationCommand>
Dispatches a
ToolInvocationCommand through the ToolExecutionService chokepoint.
On an allowed, executed call it writes the result into context via the shared
ToolResultApplier and continues; on approval-pending it suspends the run in
WorkflowStatus.AWAITING_TOOL_APPROVAL; on a policy denial or a failure (after the
service's retries) it suspends in WorkflowStatus.AWAITING_TOOL_DECISION for an operator
continue/retry decision (the service has already persisted the pending row and audited the
outcome).-
Constructor Summary
ConstructorsConstructorDescriptionToolInvocationCommandHandler(ToolExecutionService toolExecutionService, ToolResultApplier toolResultApplier, Clock clock) Creates the handler over the execution chokepoint. -
Method Summary
Modifier and TypeMethodDescriptionapply(ToolInvocationCommand cmd, CommandApplicationRequest request) Applies state changes forllmCommandusingrequest.Command type this handler applies; used as the map key inCommandApplier.
-
Constructor Details
-
ToolInvocationCommandHandler
public ToolInvocationCommandHandler(ToolExecutionService toolExecutionService, ToolResultApplier toolResultApplier, Clock clock) Creates the handler over the execution chokepoint.- Parameters:
toolExecutionService- the execution chokepointtoolResultApplier- shared result-to-state routineclock- clock for the approval-suspend timestamp
-
-
Method Details
-
getCommandClass
Description copied from interface:CommandHandlerCommand type this handler applies; used as the map key inCommandApplier.- Specified by:
getCommandClassin interfaceCommandHandler<ToolInvocationCommand>- Returns:
- non-null command class token
-
apply
Description copied from interface:CommandHandlerApplies state changes forllmCommandusingrequest.- Specified by:
applyin interfaceCommandHandler<ToolInvocationCommand>- Parameters:
cmd- parsed command instancerequest- mutable state bundle for the application pass- Returns:
- control-flow signal after this command
-