Module agentforge4j.runtime
Package com.agentforge4j.runtime.command
Interface CommandHandler<C extends LlmCommand>
- Type Parameters:
C- concreteLlmCommandsubtype this handler accepts
- All Known Implementing Classes:
ToolInvocationCommandHandler
public interface CommandHandler<C extends LlmCommand>
Strategy for applying one concrete
LlmCommand type to
WorkflowState and related context.
Implementations record side effects through EventRecorder
where appropriate and return a CommandApplicationResult that tells the engine whether to
keep executing, pause, or finish a loop iteration.
-
Method Summary
Modifier and TypeMethodDescriptionapply(C llmCommand, CommandApplicationRequest request) Applies state changes forllmCommandusingrequest.static voidensureContextOutputKeyAllowed(String key, ContextMapping contextMapping, String agentId) Ensureskeyappears inContextMapping.outputKeys()when that list is non-empty.Command type this handler applies; used as the map key inCommandApplier.
-
Method Details
-
getCommandClass
Command type this handler applies; used as the map key inCommandApplier.- Returns:
- non-null command class token
-
apply
Applies state changes forllmCommandusingrequest.- Parameters:
llmCommand- parsed command instancerequest- mutable state bundle for the application pass- Returns:
- control-flow signal after this command
-
ensureContextOutputKeyAllowed
static void ensureContextOutputKeyAllowed(String key, ContextMapping contextMapping, String agentId) Ensureskeyappears inContextMapping.outputKeys()when that list is non-empty.- Parameters:
key- candidate context output keycontextMapping- active mapping declaringoutputKeysagentId- agent id used in error messages- Throws:
IllegalArgumentException- if the list is non-empty and excludeskey
-