Interface FlowGraphBuildingStrategy

All Known Implementing Classes:
ConditionalGraphBuildingStrategy, LoopGraphBuildingStrategy, ParallelGraphBuildingStrategy, RoutingGraphBuildingStrategy, SequentialGraphBuildingStrategy, SupervisorGraphBuildingStrategy

public interface FlowGraphBuildingStrategy
Strategy interface for building StateGraphs for different FlowAgent types. This design allows for extensible graph building without modifying existing code.

Each FlowAgent type should have its own strategy implementation that knows how to construct the appropriate graph structure.

  • Method Details

    • buildGraph

      Builds a StateGraph based on the provided configuration.
      Parameters:
      config - the graph configuration containing all necessary parameters
      Returns:
      the constructed StateGraph
      Throws:
      GraphStateException - if graph construction fails
    • getStrategyType

      String getStrategyType()
      Returns the type identifier for this strategy. This is used for registration and lookup purposes.
      Returns:
      the strategy type identifier
    • validateConfig

      default void validateConfig(FlowGraphBuilder.FlowGraphConfig config)
      Validates that the configuration contains all required parameters for this strategy.
      Parameters:
      config - the configuration to validate
      Throws:
      IllegalArgumentException - if validation fails
    • generateKeyStrategyFactory

      default KeyStrategyFactory generateKeyStrategyFactory(FlowGraphBuilder.FlowGraphConfig config)
      Generates a KeyStrategyFactory based on the root agent and sub-agents.
      Parameters:
      config - the configuration containing agents
      Returns:
      the generated KeyStrategyFactory
    • processAgentKeyStrategies

      default void processAgentKeyStrategies(Agent agent, Map<String,KeyStrategy> keyStrategyMap, KeyStrategy defaultStrategy)
      Recursively processes key strategies for an agent and its sub-agents.
      Parameters:
      agent - the agent to process
      keyStrategyMap - the map to populate with key strategies
      defaultStrategy - the default strategy to use when none is specified
    • processOutputKey

      default void processOutputKey(String outputKey, KeyStrategy outputKeyStrategy, Map<String,KeyStrategy> keyStrategyMap, KeyStrategy defaultStrategy)
      Processes output key and strategy for an agent.
      Parameters:
      outputKey - the output key to process
      outputKeyStrategy - the strategy for the output key
      keyStrategyMap - the map to populate
      defaultStrategy - the default strategy to use when none is specified
    • addSubAgentNode

      static void addSubAgentNode(Agent subAgent, StateGraph newGraph) throws GraphStateException
      Throws:
      GraphStateException