Class AgentExecutor.Builder

java.lang.Object
org.bsc.spring.agentexecutor.AgentExecutor.Builder
Enclosing interface:
AgentExecutor

public static class AgentExecutor.Builder extends Object
Class responsible for building a state graph.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • stateSerializer

      public AgentExecutor.Builder stateSerializer(StateSerializer<AgentExecutor.State> stateSerializer)
      Sets the state serializer for the graph builder.
      Parameters:
      stateSerializer - the state serializer to set
      Returns:
      the current instance of GraphBuilder for method chaining
    • chatService

      public AgentExecutor.Builder chatService(ChatService chatService)
    • build

      Builds and returns a StateGraph with the specified configuration. Initializes the stateSerializer if it's null. Then, constructs a new StateGraph object using the provided schema and serializer, adds an initial edge from the START node to "agent", and then proceeds to add nodes for "agent" and "action". It also sets up conditional edges from the "agent" node based on whether or not to continue.
      Returns:
      A configured StateGraph object.
      Throws:
      GraphStateException - If there is an issue with building the graph state.