agentscope-java icon indicating copy to clipboard operation
agentscope-java copied to clipboard

[Bug]: The fallbackModel feature is not working.

Open amyaxy opened this issue 5 months ago • 3 comments

AgentScope-Java is an open-source project. To involve a broader community, we recommend asking your questions in English.

Image Image

Describe the bug

ReActAgent 当主模型不可用时,没有切换到备用模型

To Reproduce Steps to reproduce the behavior:

  1. You code
  2. How to execute
  3. See error

Expected behavior A clear and concise description of what you expected to happen.

Error messages Detailed error messages.

Environment (please complete the following information):

  • AgentScope-Java Version: 2.0.0-RC4
  • Java Version: 21
  • OS: windows

Additional context Add any other context about the problem here.

amyaxy avatar Jun 22 '26 03:06 amyaxy

I looked into this. The fallbackModel feature was added in PR #1851, but the wiring seems incomplete — when the primary model fails, the fallback is not actually triggered.

My plan to fix:

  1. Reproduce by configuring a fallbackModel with an invalid primary model
  2. Trace the exception flow in ReActAgent to find where the fallback is skipped
  3. Fix the wiring so the fallback model kicks in on primary model failure

Could you assign this to me? Please

itxaiohanglover avatar Jun 22 '26 08:06 itxaiohanglover

感谢提醒。你说得对,之前的版本里 fallbackModel 只是配置进去了,但没有真正接入运行时调用链。我已经修复了 ReActAgent,现在模型调用会先走 modelForCall(),当主模型失败时会切换到 fallback。同时我也补了回归测试,覆盖 fallback 切换和 builder 克隆场景。

也就是说: 在我修复前,fallbackModel 确实只是配进去了,没有真正接入运行时调用链,所以“主模型失败时 fallback 没触发”这个判断是对的。 现在我这版已经修好了,agentscope-core\src\main\java\io\agentscope\core\ReActAgent.java 里已经走 modelForCall() 了

guslegend0510 avatar Jun 22 '26 12:06 guslegend0510

感谢提醒。你说得对,之前的版本里 fallbackModel 只是配置进去了,但没有真正接入运行时调用链。我已经修复了 ReActAgent,现在模型调用会先走 modelForCall(),当主模型失败时会切换到 fallback。同时我也补了回归测试,覆盖 fallback 切换和 builder 克隆场景。

也就是说: 在我修复前,fallbackModel 确实只是配进去了,没有真正接入运行时调用链,所以“主模型失败时 fallback 没触发”这个判断是对的。 现在我这版已经修好了,agentscope-core\src\main\java\io\agentscope\core\ReActAgent.java 里已经走 modelForCall() 了

PR合并的慢,已经冲突了

amyaxy avatar Jun 26 '26 03:06 amyaxy