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