Record Class SubCompiledGraphNodeAction<State extends AgentState>

java.lang.Object
java.lang.Record
org.bsc.langgraph4j.action.SubCompiledGraphNodeAction<State>
Type Parameters:
State - The type of state the subgraph operates on, which must extend AgentState.
Record Components:
subGraph - sub graph instance
All Implemented Interfaces:
BiFunction<State,RunnableConfig,CompletableFuture<Map<String,Object>>>, AsyncNodeActionWithConfig<State>

public record SubCompiledGraphNodeAction<State extends AgentState>(String nodeId, CompileConfig parentCompileConfig, CompiledGraph<State extends AgentState> subGraph) extends Record implements AsyncNodeActionWithConfig<State>
Represents an action to perform a subgraph on a given state with a specific configuration.

This record encapsulates the behavior required to execute a compiled graph using a provided state. It implements the AsyncNodeActionWithConfig interface, ensuring that the execution is handled asynchronously with the ability to configure settings.

See Also:
  • Constructor Details

    • SubCompiledGraphNodeAction

      public SubCompiledGraphNodeAction(String nodeId, CompileConfig parentCompileConfig, CompiledGraph<State> subGraph)
      Creates an instance of a SubCompiledGraphNodeAction record class.
      Parameters:
      nodeId - the value for the nodeId record component
      parentCompileConfig - the value for the parentCompileConfig record component
      subGraph - the value for the subGraph record component
  • Method Details

    • subGraphId

      public static String subGraphId(String nodeId)
    • resumeSubGraphId

      public static String resumeSubGraphId(String nodeId)
    • subGraphId

      public String subGraphId()
    • resumeSubGraphId

      public String resumeSubGraphId()
    • apply

      public CompletableFuture<Map<String,Object>> apply(State state, RunnableConfig config)
      Executes the given graph with the provided state and configuration.
      Specified by:
      apply in interface AsyncNodeActionWithConfig<State extends AgentState>
      Specified by:
      apply in interface BiFunction<State extends AgentState,RunnableConfig,CompletableFuture<Map<String,Object>>>
      Parameters:
      state - The current state of the system, containing input data and intermediate results.
      config - The configuration for the graph execution.
      Returns:
      A CompletableFuture that will complete with a result of type Map<String, Object>. If an exception occurs during execution, the future will be completed exceptionally.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • nodeId

      public String nodeId()
      Returns the value of the nodeId record component.
      Returns:
      the value of the nodeId record component
    • parentCompileConfig

      public CompileConfig parentCompileConfig()
      Returns the value of the parentCompileConfig record component.
      Returns:
      the value of the parentCompileConfig record component
    • subGraph

      public CompiledGraph<State> subGraph()
      Returns the value of the subGraph record component.
      Returns:
      the value of the subGraph record component