Interface ToolLoop

  • All Implemented Interfaces:

    
    public interface ToolLoop
    
                        

    Embabel's own tool execution loop.

    This gives us full control over:

    • Message capture and history management

    • Dynamic tool injection via strategies

    • Observability and event emission

    This interface is framework-agnostic - implementations use LlmMessageSender for LLM communication, allowing different backends (Spring AI, LangChain4j, etc.) to be plugged in, as well as direct LLM access.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract <O extends Any> ToolLoopResult<O> execute(List<Message> initialMessages, List<Tool> initialTools, Function1<String, O> outputParser) Execute a conversation with tool calling until completion.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • execute

         abstract <O extends Any> ToolLoopResult<O> execute(List<Message> initialMessages, List<Tool> initialTools, Function1<String, O> outputParser)

        Execute a conversation with tool calling until completion.

        Parameters:
        initialMessages - The starting messages (system + user)
        initialTools - The initially available tools
        outputParser - Function to parse the final response to the output type
        Returns:

        The result containing parsed output and conversation history