Class AgentExecutor.GraphBuilder

java.lang.Object
org.bsc.langgraph4j.agentexecutor.AgentExecutor.GraphBuilder
Enclosing interface:
AgentExecutor

public static class AgentExecutor.GraphBuilder extends Object
Builder class for constructing a graph of agent execution.
  • Constructor Details

    • GraphBuilder

      public GraphBuilder()
  • Method Details

    • chatLanguageModel

      public AgentExecutor.GraphBuilder chatLanguageModel(dev.langchain4j.model.chat.ChatLanguageModel chatLanguageModel)
      Sets the chat language model for the graph builder.
      Parameters:
      chatLanguageModel - the chat language model
      Returns:
      the updated GraphBuilder instance
    • chatLanguageModel

      public AgentExecutor.GraphBuilder chatLanguageModel(dev.langchain4j.model.chat.StreamingChatLanguageModel streamingChatLanguageModel)
      Sets the streaming chat language model for the graph builder.
      Parameters:
      streamingChatLanguageModel - the streaming chat language model
      Returns:
      the updated GraphBuilder instance
    • objectsWithTools

      @Deprecated public AgentExecutor.GraphBuilder objectsWithTools(List<Object> objectsWithTools)
      Deprecated.
      Sets the objects with tools for the graph builder (deprecated).
      Parameters:
      objectsWithTools - the list of objects with tools
      Returns:
      the updated GraphBuilder instance
    • toolSpecification

      public AgentExecutor.GraphBuilder toolSpecification(Object objectsWithTool)
      Sets the tool specification for the graph builder.
      Parameters:
      objectsWithTool - the tool specification
      Returns:
      the updated GraphBuilder instance
    • toolSpecification

      public AgentExecutor.GraphBuilder toolSpecification(dev.langchain4j.agent.tool.ToolSpecification spec, dev.langchain4j.service.tool.ToolExecutor executor)
      Sets the tool specification with executor for the graph builder.
      Parameters:
      spec - the tool specification
      executor - the tool executor
      Returns:
      the updated GraphBuilder instance
    • toolSpecification

      public AgentExecutor.GraphBuilder toolSpecification(ToolNode.Specification toolSpecifications)
      Sets the tool specification for the graph builder.
      Parameters:
      toolSpecifications - the tool specifications
      Returns:
      the updated GraphBuilder instance
    • stateSerializer

      public AgentExecutor.GraphBuilder stateSerializer(StateSerializer<AgentExecutor.State> stateSerializer)
      Sets the state serializer for the graph builder.
      Parameters:
      stateSerializer - the state serializer
      Returns:
      the updated GraphBuilder instance
    • build

      Builds the state graph.
      Returns:
      the constructed StateGraph
      Throws:
      GraphStateException - if there is an error in the graph state