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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Agent.Builder<org.springframework.ai.chat.messages.Message,State> Fields inherited from class org.bsc.langgraph4j.spring.ai.agent.ReactAgentBuilder
chatModel, conversationContextPolicy, emitStreamingOutputEnd, schema, stateSerializer, streaming, systemMessage, tools -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddCallModelHook(NodeHook.WrapCall<State> wrapCall) addExecuteToolsHook(EdgeHook.WrapCall<State> wrapCall) build(Function<ReactAgentBuilder<?, ?>, ReactAgent.ChatService> chatServiceFactory) Builds and returns a StateGraph with the specified configuration.Methods inherited from class org.bsc.langgraph4j.spring.ai.agent.ReactAgentBuilder
build, chatModel, chatModel, chatModel, conversationContextPolicy, defaultSystem, emitStreamingEnd, result, schema, skills, skills, stateSerializer, streaming, systemMessage, tool, tools, tools, tools, toolsFromObject
-
Field Details
-
agentBuilder
protected Agent.Builder<org.springframework.ai.chat.messages.Message,State extends MessagesState<org.springframework.ai.chat.messages.Message>> agentBuilder
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
addCallModelHook
-
addExecuteToolsHook
-
build
public StateGraph<State> build(Function<ReactAgentBuilder<?, ?>, throws GraphStateExceptionReactAgent.ChatService> chatServiceFactory) 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:
buildin classReactAgentBuilder<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.
-