Class ActSpecFunctionTools

java.lang.Object
org.machanism.machai.gw.tools.ActSpecFunctionTools
All Implemented Interfaces:
FunctionTools

public class ActSpecFunctionTools extends Object implements FunctionTools
Provides functional tools for episode navigation and control within the ActProcessor context.

This class registers tools for moving between episodes and repeating episodes in a project workflow. It is intended for use with ActProcessor and integrates with the Genai provider.

Author:
Viktor Tovstyi
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final org.slf4j.Logger
    Logger for shell tool execution and diagnostics.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    moveToEpisode(int targetId, String name)
    AI functional tool that moves to the episode specified by id or name.
    void
    AI functional tool that repeats the current episode by terminating the current execution and restarting the same episode, preserving the context.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
      Logger for shell tool execution and diagnostics.
  • Constructor Details

    • ActSpecFunctionTools

      public ActSpecFunctionTools()
  • Method Details

    • moveToEpisode

      public void moveToEpisode(int targetId, String name)
      AI functional tool that moves to the episode specified by id or name. Sequential navigation to the next episode is handled automatically by the system and should not invoke this tool.

      This method always throws a MoveToEpisodeException to signal episode navigation.

      Parameters:
      targetId - the ID of the episode to move to
      name - the name of the episode to move to
      Throws:
      MoveToEpisodeException - always thrown to signal episode navigation
    • repeateEpisode

      public void repeateEpisode(String message)
      AI functional tool that repeats the current episode by terminating the current execution and restarting the same episode, preserving the context.

      This method can be used to re-execute the current episode, for example, after a validation failure or when additional user input is required. If a custom message is provided, it is logged before the episode is repeated.

      Parameters:
      message - A custom response message to output before repeating the episode. If empty, no message is logged.
      Throws:
      RepeatEpisodeException - always thrown to signal the episode should be repeated