Class ParallelGraphBuildingStrategy
java.lang.Object
com.alibaba.cloud.ai.graph.agent.flow.strategy.AbstractFlowGraphBuildingStrategy
com.alibaba.cloud.ai.graph.agent.flow.strategy.ParallelGraphBuildingStrategy
- All Implemented Interfaces:
FlowGraphBuildingStrategy
Strategy for building parallel execution graphs. In a parallel graph, all sub-agents
execute concurrently and their results are aggregated using a specified merge strategy.
-
Field Summary
Fields inherited from class com.alibaba.cloud.ai.graph.agent.flow.strategy.AbstractFlowGraphBuildingStrategy
afterAgentHooks, afterModelHooks, beforeAgentHooks, beforeModelHooks, entryNode, exitNode, graph, rootAgent -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidAbstract method that subclasses must implement to build their specific graph structure.protected voidConnects afterModel hook edges.protected voidConnects beforeModel hook edges.Returns the type identifier for this strategy.voidValidates that the configuration contains all required parameters for this strategy.Methods inherited from class com.alibaba.cloud.ai.graph.agent.flow.strategy.AbstractFlowGraphBuildingStrategy
addAfterAgentHookNodesToGraph, addBeforeAgentHookNodesToGraph, buildGraph, chainAfterAgentHooks, chainBeforeAgentHooks, connectAfterAgentHooks, connectAfterModelHookEdges, connectBeforeAgentHooks, connectBeforeModelHookEdges, determineEntryNode, determineExitNode, filterHooksByPosition, getRootAgentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.alibaba.cloud.ai.graph.agent.flow.strategy.FlowGraphBuildingStrategy
generateKeyStrategyFactory, processAgentKeyStrategies, processOutputKey
-
Constructor Details
-
ParallelGraphBuildingStrategy
public ParallelGraphBuildingStrategy()
-
-
Method Details
-
buildCoreGraph
Description copied from class:AbstractFlowGraphBuildingStrategyAbstract method that subclasses must implement to build their specific graph structure. All common setup (graph creation, hook filtering, node addition, etc.) is already done. Subclasses can directly access protected fields: graph, rootAgent, beforeModelHooks, afterModelHooks, entryNode, exitNode.Note: Subclasses should NOT call connectBeforeModelHookEdges() or connectAfterModelHookEdges() in this method. Instead, override the hook methods (connectBeforeModelHooks(), connectAfterModelHooks()) if custom hook connection logic is needed.
- Overrides:
buildCoreGraphin classAbstractFlowGraphBuildingStrategy- Parameters:
config- the flow graph configuration- Throws:
GraphStateException- if graph construction fails
-
connectBeforeModelHooks
Description copied from class:AbstractFlowGraphBuildingStrategyConnects beforeModel hook edges. Subclasses can override to customize behavior. Default implementation connects hooks in sequence to rootAgent.name().This method is called after buildCoreGraph() and before connectAfterModelHooks(). Subclasses that handle hook connections in buildCoreGraph() should override this method with an empty implementation to avoid duplicate edge connections.
- Overrides:
connectBeforeModelHooksin classAbstractFlowGraphBuildingStrategy- Throws:
GraphStateException- if graph construction fails
-
connectAfterModelHooks
Description copied from class:AbstractFlowGraphBuildingStrategyConnects afterModel hook edges. Subclasses can override to customize behavior. Default implementation connects hooks in sequence from rootAgent.name().This method is called after connectBeforeModelHooks() and before connectBeforeAgentHooks(). Subclasses that handle hook connections in buildCoreGraph() should override this method with an empty implementation to avoid duplicate edge connections.
- Overrides:
connectAfterModelHooksin classAbstractFlowGraphBuildingStrategy- Throws:
GraphStateException- if graph construction fails
-
getStrategyType
Description copied from interface:FlowGraphBuildingStrategyReturns the type identifier for this strategy. This is used for registration and lookup purposes.- Returns:
- the strategy type identifier
-
validateConfig
Description copied from interface:FlowGraphBuildingStrategyValidates that the configuration contains all required parameters for this strategy.- Parameters:
config- the configuration to validate
-