Interface CommandHandler<C extends LlmCommand>

Type Parameters:
C - concrete LlmCommand subtype 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 Details

    • getCommandClass

      Class<C> getCommandClass()
      Command type this handler applies; used as the map key in CommandApplier.
      Returns:
      non-null command class token
    • apply

      Applies state changes for llmCommand using request.
      Parameters:
      llmCommand - parsed command instance
      request - mutable state bundle for the application pass
      Returns:
      control-flow signal after this command
    • ensureContextOutputKeyAllowed

      static void ensureContextOutputKeyAllowed(String key, ContextMapping contextMapping, String agentId)
      Ensures key appears in ContextMapping.outputKeys() when that list is non-empty.
      Parameters:
      key - candidate context output key
      contextMapping - active mapping declaring outputKeys
      agentId - agent id used in error messages
      Throws:
      IllegalArgumentException - if the list is non-empty and excludes key