Class ReactAgent.Builder<State extends MessagesState<org.springframework.ai.chat.messages.Message>>

java.lang.Object
org.bsc.langgraph4j.spring.ai.agent.ReactAgentBuilder<ReactAgent.Builder<State>,State>
org.bsc.langgraph4j.spring.ai.agent.ReactAgent.Builder<State>
Direct Known Subclasses:
AgentExecutor.Builder
Enclosing interface:
ReactAgent

public static class ReactAgent.Builder<State extends MessagesState<org.springframework.ai.chat.messages.Message>> extends ReactAgentBuilder<ReactAgent.Builder<State>,State>
Class responsible for building a state graph.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • build

      public StateGraph<State> build(Function<ReactAgentBuilder<?,?>,ReactAgent.ChatService> chatServiceFactory) throws GraphStateException
      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.
      Specified by:
      build in class ReactAgentBuilder<ReactAgent.Builder<State extends MessagesState<org.springframework.ai.chat.messages.Message>>,State extends MessagesState<org.springframework.ai.chat.messages.Message>>
      Returns:
      A configured StateGraph object.
      Throws:
      GraphStateException - If there is an issue with building the graph state.