Package org.bsc.spring.agentexecutor
Class AgentExecutor.Builder
java.lang.Object
org.bsc.spring.agentexecutor.AgentExecutor.Builder
- Enclosing interface:
- AgentExecutor
Class responsible for building a state graph.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds and returns a StateGraph with the specified configuration.chatService
(ChatService chatService) stateSerializer
(StateSerializer<AgentExecutor.State> stateSerializer) Sets the state serializer for the graph builder.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
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
-
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.
-