Class SupervisorGraphBuildingStrategy
java.lang.Object
com.alibaba.cloud.ai.graph.agent.flow.strategy.AbstractFlowGraphBuildingStrategy
com.alibaba.cloud.ai.graph.agent.flow.strategy.SupervisorGraphBuildingStrategy
- All Implemented Interfaces:
FlowGraphBuildingStrategy
Strategy for building supervisor-based routing graphs. In a supervisor graph, an LLM
decides which sub-agent should handle the task, and sub-agents always return to the
supervisor after completion. The supervisor can then either route to another sub-agent
or mark the task as complete (END).
-
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.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, connectAfterModelHooks, connectBeforeAgentHooks, connectBeforeModelHookEdges, connectBeforeModelHooks, 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
-
SupervisorGraphBuildingStrategy
public SupervisorGraphBuildingStrategy()
-
-
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
-
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
-