-
Notifications
You must be signed in to change notification settings - Fork 361
Description
Problem Description
In ReActAgent.isFinished() method (line 755), when the model generates a tool call that doesn't exist in the toolkit, the current logic immediately terminates the ReAct loop instead of providing feedback to the model.
Current Behavior
// Line 755 in ReActAgent.java
return toolCalls.stream().noneMatch(tc -> toolkit.getTool(tc.getName()) != null);When the model calls a non-existent tool, isFinished() returns true, causing the agent to stop without executing the acting phase.
Expected Behavior
The agent should:
- Continue to the
acting()phase - Execute the tool call and return a "tool not found" error message
- Add the error to memory so the model can see it in the next iteration
- Allow the model to correct itself or try alternative approaches
Root Cause
The isFinished() method treats "no valid tools" as a termination condition, but this prevents the model from receiving error feedback about invalid tool calls.
Suggested Solution
- Remove the tool existence check from
isFinished()- let it only check if there are tool calls - Handle non-existent tools in
acting()phase by returning proper error messages - The Toolkit's
callTools()method should already handle this, so we may just need to remove the early termination logic
Impact
This issue prevents the model from learning and recovering from invalid tool calls, reducing agent robustness.
Location
File: agentscope-core/src/main/java/io/agentscope/core/ReActAgent.java
Method: isFinished(Msg msg) (around line 755)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status