java.lang.Object
com.agentforge4j.runtime.tool.ToolResultApplier
The single routine that applies a successful
ToolResult to WorkflowState, used
identically by the inline ALLOW path (ToolInvocationCommandHandler) and the
approved-resume path (DefaultWorkflowRuntime#continueAfterToolApproval) so both produce
the same state shape.
Tool output is runtime-produced, so it is written under a reserved tool.<capability>
key tagged with the current step's execution uid and is not subject to agent outputKeys
gating.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(String capability, ToolResult result, WorkflowState state, String actorId) Writes a successful tool result into workflow context.voidapplyError(String capability, String reason, WorkflowState state, String actorId) Writes a tool error (denial or failure detail) into workflow context undertool.<capability>.error, so a subsequent step or agent can branch on it.
-
Field Details
-
TOOL_CONTEXT_KEY_PREFIX
Reserved context-key prefix for tool results.- See Also:
-
TOOL_ERROR_KEY_SUFFIX
Reserved context-key suffix for a tool error (denied or failed), written undertool.<capability>.error.- See Also:
-
-
Constructor Details
-
ToolResultApplier
Creates the applier.- Parameters:
eventRecorder- sink for theCONTEXT_UPDATEDevent
-
-
Method Details
-
apply
Writes a successful tool result into workflow context.- Parameters:
capability- the logical capability whose result this isresult- the successful tool result; ignored whennullor without outputstate- the workflow state to updateactorId- actor recorded on the context-update event
-
applyError
Writes a tool error (denial or failure detail) into workflow context undertool.<capability>.error, so a subsequent step or agent can branch on it. Used by the operator continue path and by a rejected approval.- Parameters:
capability- the logical capability whose error this isreason- human-readable denial or failure detail;nullbecomes an empty stringstate- the workflow state to updateactorId- actor recorded on the context-update event
-