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 Summary
Modifier and TypeMethodDescriptionstatic voidaddSubAgentNode(Agent subAgent, StateGraph newGraph) Builds a StateGraph based on the provided configuration.default KeyStrategyFactoryGenerates a KeyStrategyFactory based on the root agent and sub-agents.Returns the type identifier for this strategy.default voidprocessAgentKeyStrategies(Agent agent, Map<String, KeyStrategy> keyStrategyMap, KeyStrategy defaultStrategy) Recursively processes key strategies for an agent and its sub-agents.default voidprocessOutputKey(String outputKey, KeyStrategy outputKeyStrategy, Map<String, KeyStrategy> keyStrategyMap, KeyStrategy defaultStrategy) Processes output key and strategy for an agent.default voidValidates that the configuration contains all required parameters for this strategy.
-
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
Validates that the configuration contains all required parameters for this strategy.- Parameters:
config- the configuration to validate- Throws:
IllegalArgumentException- if validation fails
-
generateKeyStrategyFactory
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 processkeyStrategyMap- the map to populate with key strategiesdefaultStrategy- 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 processoutputKeyStrategy- the strategy for the output keykeyStrategyMap- the map to populatedefaultStrategy- the default strategy to use when none is specified
-
addSubAgentNode
- Throws:
GraphStateException
-