Class AgentExecutorEx.Builder
java.lang.Object
org.bsc.langgraph4j.spring.ai.agent.ReactAgentBuilder<AgentExecutorEx.Builder,AgentExecutorEx.State>
org.bsc.langgraph4j.spring.ai.agentexecutor.AgentExecutorEx.Builder
- Enclosing interface:
- AgentExecutorEx
public static class AgentExecutorEx.Builder
extends ReactAgentBuilder<AgentExecutorEx.Builder,AgentExecutorEx.State>
Class responsible for building a state graph.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AgentEx.Builder<org.springframework.ai.chat.messages.Message,AgentExecutorEx.State, org.springframework.ai.tool.ToolCallback> 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 TypeMethodDescriptionapprovalOn(String actionId, BiFunction<String, AgentExecutorEx.State, InterruptionMetadata<AgentExecutorEx.State>> interruptionMetadataProvider) 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 AgentEx.Builder<org.springframework.ai.chat.messages.Message,AgentExecutorEx.State, agentBuilderorg.springframework.ai.tool.ToolCallback>
-
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
addCallModelHook
-
addDispatchToolsHook
public AgentExecutorEx.Builder addDispatchToolsHook(NodeHook.WrapCall<AgentExecutorEx.State> wrapCall) -
addApprovalActionHook
public AgentExecutorEx.Builder addApprovalActionHook(EdgeHook.WrapCall<AgentExecutorEx.State> wrapCall) -
addDispatchActionHook
public AgentExecutorEx.Builder addDispatchActionHook(EdgeHook.WrapCall<AgentExecutorEx.State> wrapCall) -
addShouldContinueHook
public AgentExecutorEx.Builder addShouldContinueHook(EdgeHook.WrapCall<AgentExecutorEx.State> wrapCall) -
approvalOn
public AgentExecutorEx.Builder approvalOn(String actionId, BiFunction<String, AgentExecutorEx.State, InterruptionMetadata<AgentExecutorEx.State>> interruptionMetadataProvider) -
build
public StateGraph<AgentExecutorEx.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<AgentExecutorEx.Builder,AgentExecutorEx.State> - Returns:
- A configured StateGraph object.
- Throws:
GraphStateException- If there is an issue with building the graph state.
-