Feature Request
希望 LlmRoutingAgent 的 subAgents 支持 FlowAgent 嵌套,实现 Router + Workflow + Agent 的多层编排能力。
Is your feature request related to a problem? Please describe
错误
尝试将 SequentialAgent 作为 LlmRoutingAgent 的 subAgent 时抛出异常。
代码
@Bean
public LlmRoutingAgent nimbusRouterAgent(ChatModel chatModel,
SequentialAgent weatherSequentialAgent,
ReactAgent chitchatAgent) {
return LlmRoutingAgent.builder()
.name("router")
.model(chatModel)
.description("路由")
.subAgents(List.of(weatherSequentialAgent, chitchatAgent))
.build();
}
异常
java.lang.IllegalArgumentException: Routing sub-agents must be BaseAgent for merge support
at com.alibaba.cloud.ai.graph.agent.flow.strategy.RoutingGraphBuildingStrategy.buildCoreGraph(RoutingGraphBuildingStrategy.java:84)
原因
RoutingGraphBuildingStrategy 第 80-84 行硬性检查 instanceof BaseAgent,SequentialAgent 和 ParallelAgent 继承自 FlowAgent,不属于 BaseAgent 体系,因此被拒绝。
for (Agent subAgent : config.getSubAgents()) {
if (!(subAgent instanceof BaseAgent)) {
throw new IllegalArgumentException("Routing sub-agents must be BaseAgent for merge support");
}
baseAgentList.add((BaseAgent) subAgent);
}
环境信息
- spring-ai-alibaba-agent-framework: 1.1.2.2
- spring-ai: 1.1.4
Describe the solution you'd like
希望 LlmRoutingAgent 的 subAgents 支持 FlowAgent(SequentialAgent、ParallelAgent 等),
使 Router 能挂载任意类型的 Agent,实现路由 + 工作流的嵌套编排。
期望用法:
LlmRoutingAgent router = LlmRoutingAgent.builder()
.name("router")
.model(chatModel)
.subAgents(List.of(sequentialAgent1, sequentialAgent2))
.build();
Describe alternatives you've considered
No response
Additional context
No response
Feature Request
希望 LlmRoutingAgent 的 subAgents 支持 FlowAgent 嵌套,实现 Router + Workflow + Agent 的多层编排能力。
Is your feature request related to a problem? Please describe
错误
尝试将 SequentialAgent 作为 LlmRoutingAgent 的 subAgent 时抛出异常。
代码
异常
原因
RoutingGraphBuildingStrategy 第 80-84 行硬性检查 instanceof BaseAgent,SequentialAgent 和 ParallelAgent 继承自 FlowAgent,不属于 BaseAgent 体系,因此被拒绝。
环境信息
Describe the solution you'd like
希望 LlmRoutingAgent 的 subAgents 支持 FlowAgent(SequentialAgent、ParallelAgent 等),
使 Router 能挂载任意类型的 Agent,实现路由 + 工作流的嵌套编排。
期望用法:
Describe alternatives you've considered
No response
Additional context
No response